Skip to content

Instantly share code, notes, and snippets.

@deanveloper
Created March 19, 2015 03:46
Show Gist options
  • Save deanveloper/4c9b3bc1f3bef3403bd7 to your computer and use it in GitHub Desktop.
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
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