JScrollPane mouse-wheel area
I have a JScrollPane
and a JPanel
inside. I see the scrollbars when needed, but the mouse wheeling works only when the mouse is over the scrollbars. Is there a property or something to make mouse wheeling work when开发者_如何学JAVA the mouse pointer is over the whole panel, not just the scrollbars? You know like in browsers - you can scroll the page even if the mouse pointer is not over the scrollbars.
Thanks in advance!
It works for me (Java 6, Windows, JScrollPane containing a JPanel, mouse wheeling over JPanel). JPanel with rounded 100 pixel borders, min size 1000x1000, preferred size (4000x4000).
So I guess, that your existing code interferes. Try a separate example, and then rework your app.
Make sure main window(possibly a JFrame
) implements Scrollable
.
精彩评论