Mouse wheel not working with JScrollPane when JPanel is launched
843805Feb 24 2007 — edited Feb 27 2007I have an swing application where on clicking a button a new JPanel is launched in the JFrame. The panels are contained in a CardLayout. JPanel contains a JScrollPane (containing a JTable) which does not scroll when I use the mouse wheel. Even when I click within the JScrollPane area or on the scroll bars, mouse wheel still does not work.
However, if I switch out of the window to some other application, minimize the JFrame window and restore it or launch an input dialog from a row in JTable and close it, the mouse wheel starts to work.
I have tried following solution and nothing seems to work :-(
1) Requesting focus to JScrollPane
2) Adding MouseWheelListener to to JScrollPane
3) Calling repaint(), invalidate() methods on JScrollPane, JPanel, JFrame
I am using Windows XP but the problem also occurs on Max OSX. I have tried jdk versions 1.4 through 1.6.
I will be very grateful for any help.
Thanks.