How can I move programmatically a JScrollBar
based on amount of wheel mouse rotation?
views:
34answers:
3
A:
The type of scrolling that occurs, either WHEEL_UNIT_SCROLL or WHEEL_BLOCK_SCROLL, is platform dependent. The amount that the mouse wheel scrolls is also platform dependent. Both the type and amount of scrolling can be set via the mouse control panel for the platform.control panel for the platform.
From here
johnbk
2010-09-21 09:17:51
A:
org.life.java
2010-09-21 09:32:19
Yes but what methods of a JScrollBar I must use to update it?
xdevel2000
2010-09-21 09:36:33
@xdevel2000 edited
org.life.java
2010-09-21 10:01:36
+1
A:
you can use the setValue
method of the JScrollBar to set the position of the scroll bar.
Alternatively you can use the methods of the Model behind the JScrollBar; example: bar.getModel().setValue(position)
.
You can use the getMinimum
and getmaximum
methods of the JScrollBar (or from the Model) to check the valid values for setValue
.
The Javadoc should help more: JScrollBar
Carlos Heuberger
2010-09-21 09:52:00