Created
March 19, 2015 03:46
-
-
Save deanveloper/4c9b3bc1f3bef3403bd7 to your computer and use it in GitHub Desktop.
Idk my mouse wheel seems broken so I made this to test it
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.swing.*; | |
public class Tests{ | |
public static void main(String[] args){ | |
JFrame frame = new JFrame("mouse wheel test"); | |
frame.setBounds(30, 30, 300, 300); | |
JLabel status = new JLabel("nothing"); | |
frame.add(status); | |
status.setLocation(50, 50); | |
frame.addMouseWheelListener(e -> { | |
status.setText(e.getWheelRotation() == 1 ? "up" : "down"); | |
status.repaint(); | |
}); | |
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); | |
frame.setVisible(true); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment