java.awt
public class Scrollbar extends Component implements Accessible, Adjustable
Modifier and Type | Class and Description |
---|---|
protected class |
Scrollbar.AccessibleAWTScrollBar
This class provides accessibility support for the
scrollbar.
|
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
Modifier and Type | Field and Description |
---|---|
static int |
HORIZONTAL
Constant indicating that a scrollbar is horizontal.
|
static int |
VERTICAL
Constant indicating that a scrollbar is vertical.
|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
NO_ORIENTATION
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
Scrollbar()
Initializes a new instance of
Scrollbar with a
vertical orientation and default values for all other parameters. |
Scrollbar(int orientation)
Initializes a new instance of
Scrollbar with the
specified orientation and default values for all other parameters. |
Scrollbar(int orientation,
int value,
int visibleAmount,
int minimum,
int maximum)
Initializes a new instance of
Scrollbar with the
specified parameters. |
Modifier and Type | Method and Description |
---|---|
void |
addAdjustmentListener(AdjustmentListener listener)
Adds a new adjustment listener to the list of registered listeners
for this object.
|
void |
addNotify()
Notifies this object to create its native peer.
|
AccessibleContext |
getAccessibleContext()
Gets the AccessibleContext associated with this
Scrollbar . |
AdjustmentListener[] |
getAdjustmentListeners()
Returns an array of all registered adjustment listeners.
|
int |
getBlockIncrement()
Returns the value added or subtracted when the user activates the scrollbar
scroll by a "block" amount.
|
int |
getLineIncrement()
Deprecated.
This method is deprecated in favor of
getUnitIncrement() . |
<T extends EventListener> |
getListeners(Class<T> listenerType)
Returns an array of all the objects currently registered as FooListeners
upon this
Scrollbar . |
int |
getMaximum()
Returns the maximum value for this scrollbar.
|
int |
getMinimum()
Returns the minimum value for this scrollbar.
|
int |
getOrientation()
Returns the orientation constant for this object.
|
int |
getPageIncrement()
Deprecated.
This method is deprecated in favor of
getBlockIncrement() . |
int |
getUnitIncrement()
Returns the value added or subtracted when the user activates the scrollbar
scroll by a "unit" amount.
|
int |
getValue()
Returns the current value for this scrollbar.
|
boolean |
getValueIsAdjusting()
Returns true if the value is in the process of changing.
|
int |
getVisible()
Deprecated.
This method is deprecated in favor of
getVisibleAmount() . |
int |
getVisibleAmount()
Returns the width of the scrollbar's thumb, in units relative to the
maximum and minimum value of the scrollbar.
|
protected String |
paramString()
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.
|
protected void |
processEvent(AWTEvent event)
Processes events for this scrollbar.
|
void |
removeAdjustmentListener(AdjustmentListener listener)
Removes the specified listener from the list of registered listeners
for this object.
|
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.
|
void |
setLineIncrement(int lineIncrement)
Deprecated.
This method is deprecated in favor of
setUnitIncrement() . |
void |
setMaximum(int maximum)
Sets the maximum value for this scrollbar to the specified value.
|
void |
setMinimum(int minimum)
Sets the minimum value for this scrollbar to the specified value.
|
void |
setOrientation(int orientation)
Sets the orientation of this scrollbar to the specified value.
|
void |
setPageIncrement(int pageIncrement)
Deprecated.
This method is deprecated in favor of
setBlockIncrement() . |
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.
|
void |
setValue(int value)
Sets the current value for this scrollbar to the specified value.
|
void |
setValueIsAdjusting(boolean valueIsAdjusting)
Sets the value of valueIsAdjusting.
|
void |
setValues(int value,
int visibleAmount,
int minimum,
int maximum)
Sets the current value, visible amount, minimum, and maximum for this
scrollbar.
|
void |
setVisibleAmount(int visibleAmount)
Sets the width of the scrollbar's thumb, in units relative to the
maximum and minimum value of the scrollbar.
|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paint, paintAll, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, update, validate
public static final int HORIZONTAL
public static final int VERTICAL
public Scrollbar()
Scrollbar
with a
vertical orientation and default values for all other parameters.HeadlessException
- If GraphicsEnvironment.isHeadless() is true,public Scrollbar(int orientation) throws IllegalArgumentException
Scrollbar
with the
specified orientation and default values for all other parameters.
The orientation must be either the constant HORIZONTAL
or
VERTICAL
from this class. An incorrect value will throw
an exception.orientation
- The orientation of this scrollbar.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
Scrollbar
with the
specified parameters. The orientation must be either the constant
HORIZONTAL
or VERTICAL
. An incorrect value
will throw an exception. Inconsistent values for other parameters
are silently corrected to valid values.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.HeadlessException
- If GraphicsEnvironment.isHeadless() is true,IllegalArgumentException
- If the orientation value is not valid.public int getOrientation()
getOrientation
in interface Adjustable
Adjustable.HORIZONTAL
,
Adjustable.VERTICAL
,
Adjustable.NO_ORIENTATION
public void setOrientation(int orientation)
HORIZONTAL
or
VERTICAL
from this class or an exception will be thrown.orientation
- The new orientation value.IllegalArgumentException
- If the orientation value is not valid.public int getValue()
getValue
in interface Adjustable
public void setValue(int value)
setValue
in interface Adjustable
value
- The new value for this scrollbar.public int getMaximum()
getMaximum
in interface Adjustable
public void setMaximum(int maximum)
setMaximum
in interface Adjustable
maximum
- The new maximum value for this scrollbar.public int getMinimum()
getMinimum
in interface Adjustable
public void setMinimum(int minimum)
setMinimum
in interface Adjustable
minimum
- The new minimum value for this scrollbar.public int getVisibleAmount()
getVisibleAmount
in interface Adjustable
public int getVisible()
getVisibleAmount()
.public void setVisibleAmount(int visibleAmount)
setVisibleAmount
in interface Adjustable
visibleAmount
- The new visible amount value of the scrollbar.public void setValues(int value, int visibleAmount, int minimum, int maximum)
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 int getUnitIncrement()
getUnitIncrement
in interface Adjustable
public int getLineIncrement()
getUnitIncrement()
.public void setUnitIncrement(int unitIncrement)
setUnitIncrement
in interface Adjustable
unitIncrement
- The new unit increment amount.public void setLineIncrement(int lineIncrement)
setUnitIncrement()
.lineIncrement
- The new unit increment amount.public int getBlockIncrement()
getBlockIncrement
in interface Adjustable
public int getPageIncrement()
getBlockIncrement()
.public void setBlockIncrement(int blockIncrement)
setBlockIncrement
in interface Adjustable
blockIncrement
- The new block increment amount.public void setPageIncrement(int pageIncrement)
setBlockIncrement()
.pageIncrement
- The new block increment amount.public void addNotify()
addNotify
in class Component
Component.isDisplayable()
,
Component.removeNotify()
public void addAdjustmentListener(AdjustmentListener listener)
addAdjustmentListener
in interface Adjustable
listener
- The listener to add.AdjustmentEvent
public void removeAdjustmentListener(AdjustmentListener listener)
removeAdjustmentListener
in interface Adjustable
listener
- The listener to remove.AdjustmentEvent
protected void processEvent(AWTEvent event)
processAdjustmentEvent()
if the event is an instance of
AdjustmentEvent
, otherwise it calls the superclass to
process the event.processEvent
in class Component
event
- The event to process.Component.processComponentEvent(ComponentEvent)
,
Component.processFocusEvent(FocusEvent)
,
Component.processKeyEvent(KeyEvent)
,
Component.processMouseEvent(MouseEvent)
,
Component.processMouseMotionEvent(MouseEvent)
,
Component.processInputMethodEvent(InputMethodEvent)
,
Component.processHierarchyEvent(HierarchyEvent)
,
Component.processMouseWheelEvent(MouseWheelEvent)
protected void processAdjustmentEvent(AdjustmentEvent event)
enableEvents()
.event
- The event to process.protected String paramString()
paramString
in class Component
public <T extends EventListener> T[] getListeners(Class<T> listenerType)
Scrollbar
. FooListeners are registered using the
addFooListener method.getListeners
in class Component
listenerType
- the class of listeners to filter (null
not permitted).ClassCastException
- If listenerType doesn't specify a class or
interface that implements java.util.EventListener.Component.getComponentListeners()
,
Component.getFocusListeners()
,
Component.getHierarchyListeners()
,
Component.getHierarchyBoundsListeners()
,
Component.getKeyListeners()
,
Component.getMouseListeners()
,
Component.getMouseMotionListeners()
,
Component.getMouseWheelListeners()
,
Component.getInputMethodListeners()
,
Component.getPropertyChangeListeners()
public AdjustmentListener[] getAdjustmentListeners()
public boolean getValueIsAdjusting()
public void setValueIsAdjusting(boolean valueIsAdjusting)
public AccessibleContext getAccessibleContext()
Scrollbar
.
The context is created, if necessary.getAccessibleContext
in interface Accessible
getAccessibleContext
in class Component