This is getting me quite confused:
I have a small application that uses a JSpinner for numeric values. I added a MouseAdapter to it, setting the value depending on the resulting event’s getScrollAmount() and getWheelRotation().
Everything is working quite fine as long as the application is run on linux (Debian Wheezy, Oracle JDK 1.6.0_32). That is, scrolling the mouse wheel while the JSpinner has focus works just fine (using GTK LookAndFeel).
Testing the software on Microsoft Windows exposed a different behavior:
The JSpinner will not react on mouse wheel movement. LookAndFeels don’t seem to be a problem here, as i already tried MetalLookAndFeel on both Linux and Windows.
Any suggestions on how to get this JSpinner reacting on MouseWheelEvents on both OSes?
Thank you.
Hmm im not sure what could be wrong, but here is code designed on windows 7 and it works fine so maybe try it out on yours and see where the code is different:
Also to mention, I could not find the getDirection() method in the MouseWheelEvent like you said you are using so i used the getUnitsToScroll() which will return either a positive or negative value depending on the direction. Maybe this is whats causing the trouble. Where did you find a getDirection() method in the MouseWheelEvent Class?