Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Mouse wheel not working with JScrollPane when JPanel is launched

843805Feb 24 2007 — edited Feb 27 2007
I 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.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 27 2007
Added on Feb 24 2007
3 comments
548 views