class org.aswing.JScrollBar extends Component
Interfaces | |||
![]() | Orientable |
|
An implementation of a scrollbar.
The user positions the knob in the scrollbar to determine the contents of
the viewing area. The program typically adjusts the display so that the end of the scrollbar represents the
end of the displayable contents, or 100% of the contents. The start of the scrollbar is the beginning of the
displayable contents, or 0%. The position of the knob within those bounds then translates to the corresponding
percentage of the displayable contents.
*
Typically, as the position of the knob in the scrollbar changes a corresponding change is
made to the position of the JViewport
on the underlying view, changing the contents of the
JViewport
.
@author paling
![]() | Show Events | Hide Events
|
Class Fields
Instance Fields
var blockIncrement:Int
The amount to change the scrollbar's value by, given a block (usually "page") up/down request.
A ScrollBarUI
implementation typically calls this method when the
user clicks above or below the scrollbar "knob" to change the value up or down by
large amount. Subclasses my override this method to compute a value, e.g. the change
required to scroll up or down one paragraph in a text document.
The JScrollPane
component creates scrollbars (by default) that then
set the block increment by the viewport, if it has one. The Viewportable
interface
provides a method to return the block increment.
@see JScrollPane @see Viewportable
Sets the size of the range "covered" by the knob. Most look and feel implementations will change the value by this amount if the user clicks on either side of the knob.
@see BoundedRangeModel#setExtent()
The model that handles the scrollbar's four fundamental properties: minimum, maximum, value, extent.
var unitIncrement:Int
The amount to change the scrollbar's value by, given a unit up/down request.
*
A ScrollBarUI implementation typically calls this method when the user clicks on a scrollbar up/down arrow and uses the result to update the scrollbar's value. Subclasses may override this method to compute a value, e.g. the change required to scroll up or down one (variable height) line text or one row in a table.
The JScrollPane
component creates scrollbars (by default) that then
set the unit increment by the viewport, if it has one. The Viewportable
interface
provides a method to return the unit increment.
@see org.aswing.JScrollPane @see org.aswing.Viewportable
The scrollbar's value. This method just forwards the value to the model. @see BoundedRangeModel#setValue()
function new(?orientation:Int = 1, ?value:Int = 0, ?extent:Int = 10, ?min:Int = 0, ?max:Int = 100): Void
JScrollBar(orientation:Number, value:Number, extent:Number, min:Number, max:Number)
JScrollBar(orientation:Number) default to value=0, extent=10, min=0, max=100
Creates a scrollbar with the specified orientation, value, extent, minimum, and maximum. The "extent" is the size of the viewable area. It is also known as the "visible amount".
Note: Use setBlockIncrement to set the block increment to a size slightly smaller than the view's extent. That way, when the user jumps the knob to an adjacent position, one or two lines of the original contents remain in view.
orientation | the scrollbar's orientation to either |
value | |
extent | |
min | |
null | max |
function addStateListener(listener:Dynamic ->Void?priority:Int = 0, ?useWeakReference:Bool = false): Void
Adds a listener to listen the scrollBar's state change event. @see org.aswing.event.InteractiveEvent#STATE_CHANGED
listener | the listener |
priority | the priority |
useWeakReference | Determines whether the reference to the listener is strong or weak. |
function removeStateListener(listener:Dynamic ->Void): Void
Removes a state listener. @see org.aswing.event.InteractiveEvent#STATE_CHANGED
listener | the listener to be removed. |