new JScrollBar()
public function JScrollBar(orientation:Number, value:Number, extent:Number, min:Number, max:Number)
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 VERTICAL or HORIZONTAL. |
value | |
extent | |
min | |
max |
static public HORIZONTAL:Number
static public VERTICAL:Number
static public ON_ADJUSTMENT_VALUE_CHANGED:String
public function setUI(ui:ScrollBarUI):Void
Description copied from Component
Sets the look and feel delegate for this component.
Component
subclasses generally override this method
to narrow the argument type. For example, in JSlider
:
public void setUI(SliderUI newUI) { super.setUI(newUI); }
Additionally Component
subclasses must provide a
getUI
method that returns the correct type. For example:
public SliderUI getUI() { return (SliderUI)ui; }
public function updateUI():Void
Description copied from Component
Resets the UI property to a value from the current look and feel.
Component
subclasses must override this method
like this:
public void updateUI() { setUI((SliderUI)UIManager.getUI(this); }
public function getUIClassID():String
Description copied from Component
Returns the UIDefaults
key used to
look up the name of the org.aswing.plaf.ComponentUI
class that defines the look and feel
for this component. Most applications will never need to
call this method. Subclasses of Component
that support
pluggable look and feel should override this method to
return a UIDefaults
key that maps to the
ComponentUI
subclass that defines their look and feel.
public function getModel():BoundedRangeModel
Returns data model that handles the scrollbar's four fundamental properties: minimum, maximum, value, extent.
the data model
public function setModel(newModel:BoundedRangeModel):Void
Sets the model that handles the scrollbar's four fundamental properties: minimum, maximum, value, extent.
public function getUnitIncrement():Number
Returns 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 my 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.
the unit increment
public function getBlockIncrement():Number
Returns 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.
the block increment
public function getValue():Number
Returns the scrollbar's value.
the scrollbar's value property.
public function setValue(value:Number):Void
Sets the scrollbar's value. This method just forwards the value to the model.
value | the value to set. |
public function getVisibleAmount():Number
Returns the scrollbar's extent. In many scrollbar look and feel implementations the size of the scrollbar "knob" or "thumb" is proportional to the extent.
the scrollbar's extent.
public function setVisibleAmount(extent:Number):Void
Set the model's extent property.
extent | the extent to set |
public function getMinimum():Number
Returns the minimum value supported by the scrollbar (usually zero).
the minimum value supported by the scrollbar
public function setMinimum(minimum:Number):Void
Sets the model's minimum property.
minimum | the minimum to set. |
public function getMaximum():Number
Returns the maximum value supported by the scrollbar.
the maximum value supported by the scrollbar
public function setMaximum(maximum:Number):Void
Sets the model's maximum property.
maximum | the maximum to set. |
public function getValueIsAdjusting():Boolean
True if the scrollbar knob is being dragged.
the value of the model's valueIsAdjusting property
public function setValueIsAdjusting(b:Boolean):Void
Sets the model's valueIsAdjusting property. Scrollbar look and feel implementations should set this property to true when a knob drag begins, and to false when the drag ends. The scrollbar model will not generate ChangeEvents while valueIsAdjusting is true.
public function setValues(newValue:Number, newExtent:Number, newMin:Number, newMax:Number):Void
Sets the four BoundedRangeModel properties after forcing the arguments to obey the usual constraints: "minimum le value le value+extent le maximum" ("le" means less or equals)
public function addAdjustmentListener(func:Function, obj:Object):Object
Shortcut to and ON_ADJUSTMENT_VALUE_CHANGED listener.
addAdjustmentListener(func:Function)
addAdjustmentListener(func:Function, obj:Object)
func | the function which want to handler the event. |
obj | context in which to run the function of param func. |
public function setEnabled(b:Boolean):Void
Description copied from Component
Enable or disable the component.
If a component is disabled, it will not fire mouse events. And some component will has different interface when enabled or disabled. But it will also eat mouse clicks when disable even it will not fire mouse events.