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:Numberstatic public VERTICAL:Numberstatic public ON_ADJUSTMENT_VALUE_CHANGED:Stringpublic function setUI(ui:ScrollBarUI):VoidDescription 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():VoidDescription 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():StringDescription 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():BoundedRangeModelReturns data model that handles the scrollbar's four fundamental properties: minimum, maximum, value, extent.
the data model
public function setModel(newModel:BoundedRangeModel):VoidSets the model that handles the scrollbar's four fundamental properties: minimum, maximum, value, extent.
public function getUnitIncrement():NumberReturns 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():NumberReturns 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():NumberReturns the scrollbar's value.
the scrollbar's value property.
public function setValue(value:Number):VoidSets the scrollbar's value. This method just forwards the value to the model.
value | the value to set. |
public function getVisibleAmount():NumberReturns 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):VoidSet the model's extent property.
extent | the extent to set |
public function getMinimum():NumberReturns the minimum value supported by the scrollbar (usually zero).
the minimum value supported by the scrollbar
public function setMinimum(minimum:Number):VoidSets the model's minimum property.
minimum | the minimum to set. |
public function getMaximum():NumberReturns the maximum value supported by the scrollbar.
the maximum value supported by the scrollbar
public function setMaximum(maximum:Number):VoidSets the model's maximum property.
maximum | the maximum to set. |
public function getValueIsAdjusting():BooleanTrue if the scrollbar knob is being dragged.
the value of the model's valueIsAdjusting property
public function setValueIsAdjusting(b:Boolean):VoidSets 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):VoidSets 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):ObjectShortcut 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):VoidDescription 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.