Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
java.awt.Component
java.awt.Scrollbar
Nested Class Summary | |
protected class |
|
Nested classes/interfaces inherited from class java.awt.Component | |
Component.AccessibleAWTComponent , Component.BltBufferStrategy , Component.FlipBufferStrategy |
Field Summary | |
static int |
|
static int |
|
Fields inherited from class java.awt.Component | |
BOTTOM_ALIGNMENT , CENTER_ALIGNMENT , LEFT_ALIGNMENT , RIGHT_ALIGNMENT , TOP_ALIGNMENT |
Fields inherited from interface java.awt.Adjustable | |
HORIZONTAL , NO_ORIENTATION , VERTICAL |
Fields inherited from interface java.awt.image.ImageObserver | |
ABORT , ALLBITS , ERROR , FRAMEBITS , HEIGHT , PROPERTIES , SOMEBITS , WIDTH |
Constructor Summary | |
| |
| |
|
Method Summary | |
void |
|
void |
|
|
|
AccessibleContext |
|
AdjustmentListener[] |
|
int |
|
int |
|
int |
|
int |
|
int |
|
int |
|
int |
|
int |
|
boolean |
|
int |
|
int |
|
protected String |
|
protected void |
|
protected void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
Methods inherited from class java.lang.Object | |
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
public static final int HORIZONTAL
Constant indicating that a scrollbar is horizontal.
- Field Value:
- 0
public static final int VERTICAL
Constant indicating that a scrollbar is vertical.
- Field Value:
- 1
public Scrollbar()
Initializes a new instance ofScrollbar
with a vertical orientation and default values for all other parameters.
- Throws:
HeadlessException
- If GraphicsEnvironment.isHeadless() is true,
public Scrollbar(int orientation) throws IllegalArgumentException
Initializes a new instance ofScrollbar
with the specified orientation and default values for all other parameters. The orientation must be either the constantHORIZONTAL
orVERTICAL
from this class. An incorrect value will throw an exception.
- Parameters:
orientation
- The orientation of this scrollbar.
- Throws:
HeadlessException
- If GraphicsEnvironment.isHeadless() is true,IllegalArgumentException
- If the orientation value is not valid.
public Scrollbar(int orientation, int value, int visibleAmount, int minimum, int maximum) throws IllegalArgumentException
Initializes a new instance ofScrollbar
with the specified parameters. The orientation must be either the constantHORIZONTAL
orVERTICAL
. An incorrect value will throw an exception. Inconsistent values for other parameters are silently corrected to valid values.
- Parameters:
orientation
- The orientation of this scrollbar.value
- The initial value of the scrollbar.visibleAmount
- The width of the scrollbar thumb.minimum
- The minimum value of the scrollbar.maximum
- The maximum value of the scrollbar.
- Throws:
HeadlessException
- If GraphicsEnvironment.isHeadless() is true,IllegalArgumentException
- If the orientation value is not valid.
public void addAdjustmentListener(AdjustmentListener listener)
Adds a new adjustment listener to the list of registered listeners for this object.
- Specified by:
- addAdjustmentListener in interface Adjustable
- Parameters:
listener
- The listener to add.
publicextends EventListener> T[] getListeners (ClasslistenerType)
Returns an array of all the objects currently registered as FooListeners upon thisScrollbar
. FooListeners are registered using the addFooListener method.
- Overrides:
- extends EventListener> T[] getListeners in interface Component
- Throws:
ClassCastException
- If listenerType doesn't specify a class or interface that implements java.util.EventListener.
public AccessibleContext getAccessibleContext()
Gets the AccessibleContext associated with thisScrollbar
. The context is created, if necessary.
- Specified by:
- getAccessibleContext in interface Accessible
- Overrides:
- getAccessibleContext in interface Component
- Returns:
- the associated context
public AdjustmentListener[] getAdjustmentListeners()
Returns an array of all registered adjustment listeners.
public int getBlockIncrement()
Returns the value added or subtracted when the user activates the scrollbar scroll by a "block" amount.
- Specified by:
- getBlockIncrement in interface Adjustable
- Returns:
- The block increment value.
public int getLineIncrement()
Deprecated. This method is deprecated in favor of
getUnitIncrement()
.Returns the value added or subtracted when the user selects the scrollbar scroll by a "unit" amount control.
- Returns:
- The unit increment value.
public int getMaximum()
Returns the maximum value for this scrollbar.
- Specified by:
- getMaximum in interface Adjustable
- Returns:
- The maximum value for this scrollbar.
public int getMinimum()
Returns the minimum value for this scrollbar.
- Specified by:
- getMinimum in interface Adjustable
- Returns:
- The minimum value for this scrollbar.
public int getOrientation()
Returns the orientation constant for this object.
- Specified by:
- getOrientation in interface Adjustable
- Returns:
- The orientation constant for this object.
public int getPageIncrement()
Deprecated. This method is deprecated in favor of
getBlockIncrement()
.Returns the value added or subtracted when the user selects the scrollbar scroll by a "block" amount control.
- Returns:
- The block increment value.
public int getUnitIncrement()
Returns the value added or subtracted when the user activates the scrollbar scroll by a "unit" amount.
- Specified by:
- getUnitIncrement in interface Adjustable
- Returns:
- The unit increment value.
public int getValue()
Returns the current value for this scrollbar.
- Specified by:
- getValue in interface Adjustable
- Returns:
- The current value for this scrollbar.
public boolean getValueIsAdjusting()
Returns true if the value is in the process of changing.
- Since:
- 1.4
public int getVisible()
Deprecated. This method is deprecated in favor of
getVisibleAmount()
.Returns the width of the scrollbar's thumb, in units relative to the maximum and minimum value of the scrollbar.
- Returns:
- The width of the scrollbar's thumb.
public int getVisibleAmount()
Returns the width of the scrollbar's thumb, in units relative to the maximum and minimum value of the scrollbar.
- Specified by:
- getVisibleAmount in interface Adjustable
- Returns:
- The width of the scrollbar's thumb.
protected String paramString()
Returns a debugging string for this object.
- Overrides:
- paramString in interface Component
- Returns:
- A debugging string for this object.
protected void processAdjustmentEvent(AdjustmentEvent event)
Processes adjustment events for this object by dispatching them to any registered listeners. Note that this method will only be called if adjustment events are enabled. This will happen automatically if any listeners are registered. Otherwise, it can be enabled by a call toenableEvents()
.
- Parameters:
event
- The event to process.
protected void processEvent(AWTEvent event)
Processes events for this scrollbar. It does this by callingprocessAdjustmentEvent()
if the event is an instance ofAdjustmentEvent
, otherwise it calls the superclass to process the event.
- Overrides:
- processEvent in interface Component
- Parameters:
event
- The event to process.
public void removeAdjustmentListener(AdjustmentListener listener)
Removes the specified listener from the list of registered listeners for this object.
- Specified by:
- removeAdjustmentListener in interface Adjustable
- Parameters:
listener
- The listener to remove.
public void setBlockIncrement(int blockIncrement)
Sets the value added or subtracted to the scrollbar value when the user selects the scroll by a "block" amount control.
- Specified by:
- setBlockIncrement in interface Adjustable
- Parameters:
blockIncrement
- The new block increment amount.
public void setLineIncrement(int lineIncrement)
Deprecated. This method is deprecated in favor of
setUnitIncrement()
.Sets the value added or subtracted to the scrollbar value when the user selects the scroll by a "unit" amount control.
- Parameters:
lineIncrement
- The new unit increment amount.
public void setMaximum(int maximum)
Sets the maximum value for this scrollbar to the specified value. If the value is less than the current minimum value, it is silent set to equal the minimum value.
- Specified by:
- setMaximum in interface Adjustable
- Parameters:
maximum
- The new maximum value for this scrollbar.
public void setMinimum(int minimum)
Sets the minimum value for this scrollbar to the specified value. If this is not consistent with the current value and maximum, it is silently adjusted to be consistent.
- Specified by:
- setMinimum in interface Adjustable
- Parameters:
minimum
- The new minimum value for this scrollbar.
public void setOrientation(int orientation)
Sets the orientation of this scrollbar to the specified value. This value must be either the constantHORIZONTAL
orVERTICAL
from this class or an exception will be thrown.
- Parameters:
orientation
- The new orientation value.
- Throws:
IllegalArgumentException
- If the orientation value is not valid.
public void setPageIncrement(int pageIncrement)
Deprecated. This method is deprecated in favor of
setBlockIncrement()
.Sets the value added or subtracted to the scrollbar value when the user selects the scroll by a "block" amount control.
- Parameters:
pageIncrement
- The new block increment amount.
public void setUnitIncrement(int unitIncrement)
Sets the value added or subtracted to the scrollbar value when the user selects the scroll by a "unit" amount control.
- Specified by:
- setUnitIncrement in interface Adjustable
- Parameters:
unitIncrement
- The new unit increment amount.
public void setValue(int value)
Sets the current value for this scrollbar to the specified value. If this is inconsistent with the minimum and maximum values for this scrollbar, the value is silently adjusted.
- Specified by:
- setValue in interface Adjustable
- Parameters:
value
- The new value for this scrollbar.
public void setValueIsAdjusting(boolean valueIsAdjusting)
Sets the value of valueIsAdjusting.
- Since:
- 1.4
public void setValues(int value, int visibleAmount, int minimum, int maximum)
Sets the current value, visible amount, minimum, and maximum for this scrollbar. These values are adjusted to be internally consistent if necessary.
- Parameters:
value
- The new value for this scrollbar.visibleAmount
- The new visible amount for this scrollbar.minimum
- The new minimum value for this scrollbar.maximum
- The new maximum value for this scrollbar.
public void setVisibleAmount(int visibleAmount)
Sets the width of the scrollbar's thumb, in units relative to the maximum and minimum value of the scrollbar.
- Specified by:
- setVisibleAmount in interface Adjustable
- Parameters:
visibleAmount
- The new visible amount value of the scrollbar.