java.awt
Class Scrollbar

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Scrollbar
All Implemented Interfaces:
Accessible, Adjustable, java.awt.image.ImageObserver, MenuContainer, Serializable

public class Scrollbar
extends Component
implements Adjustable, Accessible

Unsafe:

See Also:
Serialized Form

Field Summary
(package private)  AdjustmentListener adjustmentListener
           
private static String base
           
static int HORIZONTAL
          Enabled: A constant that indicates a horizontal scroll bar.
(package private)  boolean isAdjusting
          The adjusting status of the Scrollbar.
(package private)  int lineIncrement
          The amount by which the scrollbar value will change when going up or down by a line.
(package private)  int maximum
          The maximum value of the Scrollbar.
(package private)  int minimum
          The minimum value of the Scrollbar.
private static int nameCounter
           
(package private)  int orientation
          The Scrollbar's orientation--being either horizontal or vertical.
(package private)  int pageIncrement
          The amount by which the scrollbar value will change when going up or down by a page.
private  int scrollbarSerializedDataVersion
          The scrollbars serialized Data Version.
private static long serialVersionUID
           
(package private)  int value
          The value of the Scrollbar.
static int VERTICAL
          Enabled: A constant that indicates a vertical scroll bar.
(package private)  int visibleAmount
          The size of the visible portion of the Scrollbar.
 
Fields inherited from class java.awt.Component
accessibleContext, actionListenerK, adjustmentListenerK, appContext, background, BOTTOM_ALIGNMENT, bufferStrategy, CENTER_ALIGNMENT, componentListener, componentListenerK, componentOrientation, containerListenerK, cursor, dropTarget, enabled, eventMask, focusListener, focusListenerK, focusTraversalKeys, font, foreground, graphicsConfig, height, hierarchyBoundsListener, hierarchyBoundsListenerK, hierarchyListener, hierarchyListenerK, ignoreRepaint, incRate, inputMethodListener, inputMethodListenerK, isInc, isPacked, itemListenerK, keyListener, keyListenerK, LEFT_ALIGNMENT, locale, LOCK, metrics, minSize, mouseListener, mouseListenerK, mouseMotionListener, mouseMotionListenerK, mouseWheelListener, mouseWheelListenerK, newEventsOnly, ownedWindowK, parent, peer, peerFont, popups, prefSize, RIGHT_ALIGNMENT, textListenerK, TOP_ALIGNMENT, valid, visible, width, windowClosingException, windowFocusListenerK, windowListenerK, windowStateListenerK, x, y
 
Fields inherited from interface java.awt.Adjustable
NO_ORIENTATION
 
Constructor Summary
Scrollbar()
          Suppressed: Constructs a new vertical scroll bar.
Scrollbar(int orientation)
          Suppressed: Constructs a new scroll bar with the specified orientation.
Scrollbar(int orientation, int value, int visible, int minimum, int maximum)
          Suppressed: Constructs a new scroll bar with the specified orientation, initial value, visible amount, and minimum and maximum values.
 
Method Summary
 void addAdjustmentListener(AdjustmentListener l)
          Suppressed: Adds the specified adjustment listener to receive instances of AdjustmentEvent from this scroll bar.
 void addNotify()
          Suppressed: Creates the Scrollbar's peer.
(package private)  String constructComponentName()
          Constructs a name for this component.
(package private)  boolean eventEnabled(AWTEvent e)
           
 AccessibleContext getAccessibleContext()
          Suppressed: Gets the AccessibleContext associated with this Scrollbar.
 AdjustmentListener[] getAdjustmentListeners()
          Suppressed: Returns an array of all the adjustment listeners registered on this scrollbar.
 int getBlockIncrement()
          Suppressed: Gets the block increment of this scroll bar.
 int getLineIncrement()
          Suppressed: @deprecated As of JDK version 1.1, replaced by getUnitIncrement().
 EventListener[] getListeners(Class listenerType)
          Suppressed: Returns an array of all the objects currently registered as FooListeners upon this Scrollbar.
 int getMaximum()
          Suppressed: Gets the maximum value of this scroll bar.
 int getMinimum()
          Suppressed: Gets the minimum value of this scroll bar.
 int getOrientation()
          Suppressed: Returns the orientation of this scroll bar.
 int getPageIncrement()
          Suppressed: @deprecated As of JDK version 1.1, replaced by getBlockIncrement().
 int getUnitIncrement()
          Suppressed: Gets the unit increment for this scrollbar.
 int getValue()
          Suppressed: Gets the current value of this scroll bar.
 boolean getValueIsAdjusting()
          Suppressed: Returns true if the value is in the process of changing as a result of actions being taken by the user.
 int getVisible()
          Suppressed: @deprecated As of JDK version 1.1, replaced by getVisibleAmount().
 int getVisibleAmount()
          Suppressed: Gets the visible amount of this scroll bar.
private static void initIDs()
          Initialize JNI field and method IDs.
protected  String paramString()
          Returns a string representing the state of this Scrollbar.
protected  void processAdjustmentEvent(AdjustmentEvent e)
          Processes adjustment events occurring on this scrollbar by dispatching them to any registered AdjustmentListener objects.
protected  void processEvent(AWTEvent e)
          Processes events on this scroll bar.
private  void readObject(ObjectInputStream s)
          Reads the ObjectInputStream and if it isn't null adds a listener to receive adjustment events fired by the Scrollbar.
 void removeAdjustmentListener(AdjustmentListener l)
          Suppressed: Removes the specified adjustment listener so that it no longer receives instances of AdjustmentEvent from this scroll bar.
 void setBlockIncrement(int v)
          Suppressed: Sets the block increment for this scroll bar.
 void setLineIncrement(int v)
          Suppressed: @deprecated As of JDK version 1.1, replaced by setUnitIncrement(int).
 void setMaximum(int newMaximum)
          Suppressed: Sets the maximum value of this scroll bar.
 void setMinimum(int newMinimum)
          Suppressed: Sets the minimum value of this scroll bar.
 void setOrientation(int orientation)
          Suppressed: Sets the orientation for this scroll bar.
 void setPageIncrement(int v)
          Suppressed: @deprecated As of JDK version 1.1, replaced by setBlockIncrement().
 void setUnitIncrement(int v)
          Suppressed: Sets the unit increment for this scroll bar.
 void setValue(int newValue)
          Suppressed: Sets the value of this scroll bar to the specified value.
 void setValueIsAdjusting(boolean b)
          Suppressed: Sets the valueIsAdjusting property.
 void setValues(int value, int visible, int minimum, int maximum)
          Suppressed: Sets the values of four properties for this scroll bar: value, visibleAmount, minimum, and maximum.
 void setVisibleAmount(int newAmount)
          Suppressed: Sets the visible amount of this scroll bar.
private  void writeObject(ObjectOutputStream s)
          Writes default serializable fields to stream.
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, adjustListeningChildrenOnParent, applyComponentOrientation, areFocusTraversalKeysSet, areInputMethodsEnabled, autoProcessMouseWheel, autoTransferFocus, bounds, checkGD, checkImage, checkImage, checkWindowClosingException, clearCurrentFocusCycleRootOnHide, clearMostRecentFocusOwnerOnHide, coalesceEvents, contains, contains, containsFocus, countHierarchyMembers, createBufferStrategy, createBufferStrategy, createChildHierarchyEvents, createHierarchyEvents, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, dispatchEventImpl, dispatchMouseWheelToAncestor, doLayout, enable, enable, enableEvents, enableInputMethods, eventTypeEnabled, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleIndexInParent, getAccessibleStateSet, getAlignmentX, getAlignmentY, getBackBuffer, getBackground, getBounds, getBounds, getBufferStrategy, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys_NoIDCheck, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont_NoClientCode, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen_NoTreeLock, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getNativeContainer, getParent_NoClientCode, getParent, getPeer, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getToolkitImpl, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, initializeFocusTraversalKeys, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isEnabledImpl, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFocusTraversableOverridden, isFontSet, isForegroundSet, isLightweight, isOpaque, isRecursivelyVisible, isShowing, isValid, isVisible, iterate, keyDown, keyUp, layout, lightweightPaint, lightweightPrint, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, nextFocusHelper, numListening, paint, paintAll, paintHeavyweightComponents, postEvent, postsOldMouseEvents, preferredSize, prepareImage, prepareImage, print, printAll, printHeavyweightComponents, 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, requestFocusHelper, requestFocusInWindow, requestFocusInWindow, resetGC, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys_NoIDCheck, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setGCFromPeer, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocus, transferFocusBackward, transferFocusUpCycle, update, updateCursorImmediately, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

HORIZONTAL

public static final int HORIZONTAL
Enabled: A constant that indicates a horizontal scroll bar.


VERTICAL

public static final int VERTICAL
Enabled: A constant that indicates a vertical scroll bar.


value

int value
The value of the Scrollbar. This property must be greater than or equal to minimum and less than or equal to maximum - visibleAmount

See Also:
getValue(), setValue(int)

maximum

int maximum
The maximum value of the Scrollbar. This value must be greater than the minimum value.
This integer can be either positive or negative, and its range can be altered at any time.

See Also:
getMaximum(), setMaximum(int)

minimum

int minimum
The minimum value of the Scrollbar. This value must be less than the maximum value.
This integer can be either positive or negative.

See Also:
getMinimum(), setMinimum(int)

visibleAmount

int visibleAmount
The size of the visible portion of the Scrollbar. This parameter is normally used to indicate the range of values that are currently visible.

See Also:
getVisibleAmount(), setVisibleAmount(int)

orientation

int orientation
The Scrollbar's orientation--being either horizontal or vertical. This value should be specified when the scrollbar is created.
orientation can be either : VERTICAL or HORIZONTAL only.

See Also:
getOrientation(), setOrientation(int)

lineIncrement

int lineIncrement
The amount by which the scrollbar value will change when going up or down by a line. This value should be a non negative integer.

See Also:
getLineIncrement(), setLineIncrement(int)

pageIncrement

int pageIncrement
The amount by which the scrollbar value will change when going up or down by a page. This value should be a non negative integer.

See Also:
getPageIncrement(), setPageIncrement(int)

isAdjusting

transient boolean isAdjusting
The adjusting status of the Scrollbar. True if the value is in the process of changing as a result of actions being taken by the user.

Since:
1.4
See Also:
getValueIsAdjusting(), setValueIsAdjusting(boolean)

adjustmentListener

transient AdjustmentListener adjustmentListener

base

private static final String base

nameCounter

private static int nameCounter

serialVersionUID

private static final long serialVersionUID

scrollbarSerializedDataVersion

private int scrollbarSerializedDataVersion
The scrollbars serialized Data Version.

Constructor Detail

Scrollbar

public Scrollbar()
          throws HeadlessException
Suppressed: Constructs a new vertical scroll bar. The default properties of the scroll bar are listed in the following table:

Property Description Default Value
orientation indicates if the scroll bar is vertical or horizontal Scrollbar.VERTICAL
value value which controls the location
of the scroll bar bubble
0
minimum minimum value of the scroll bar 0
maximum maximum value of the scroll bar 100
unit increment amount the value changes when the
Line Up or Line Down key is pressed,
or when the end arrows of the scrollbar
are clicked
1
block increment amount the value changes when the
Page Up or Page Down key is pressed,
or when the scrollbar track is clicked
on either side of the bubble
10

See Also:
java.awt.GraphicsEnvironment#isHeadless

Scrollbar

public Scrollbar(int orientation)
          throws HeadlessException
Suppressed: Constructs a new scroll bar with the specified orientation.

The orientation argument must take one of the two values Scrollbar.HORIZONTAL, or Scrollbar.VERTICAL, indicating a horizontal or vertical scroll bar, respectively.

Parameters:
orientation - indicates the orientation of the scroll bar
See Also:
java.awt.GraphicsEnvironment#isHeadless

Scrollbar

public Scrollbar(int orientation,
                 int value,
                 int visible,
                 int minimum,
                 int maximum)
          throws HeadlessException
Suppressed: Constructs a new scroll bar with the specified orientation, initial value, visible amount, and minimum and maximum values.

The orientation argument must take one of the two values Scrollbar.HORIZONTAL, or Scrollbar.VERTICAL, indicating a horizontal or vertical scroll bar, respectively.

The parameters supplied to this constructor are subject to the constraints described in setValues(int, int, int, int).

Parameters:
orientation - indicates the orientation of the scroll bar.
value - the initial value of the scroll bar
visible - the size of the scroll bar's bubble, representing the visible portion.
minimum - the minimum value of the scroll bar
maximum - the maximum value of the scroll bar
See Also:
setValues(int, int, int, int), java.awt.GraphicsEnvironment#isHeadless
Method Detail

initIDs

private static void initIDs()
Initialize JNI field and method IDs.


constructComponentName

String constructComponentName()
Constructs a name for this component. Called by getName when the name is null.

Overrides:
constructComponentName in class Component

addNotify

public void addNotify()
Suppressed: Creates the Scrollbar's peer. The peer allows you to modify the appearance of the Scrollbar without changing any of its functionality.

Overrides:
addNotify in class Component
See Also:
Component.isDisplayable(), Component.removeNotify()

getOrientation

public int getOrientation()
Suppressed: Returns the orientation of this scroll bar.

Specified by:
getOrientation in interface Adjustable
Returns:
the orientation of this scroll bar, either Scrollbar.HORIZONTAL or Scrollbar.VERTICAL
See Also:
java.awt.Scrollbar#setOrientation

setOrientation

public void setOrientation(int orientation)
Suppressed: Sets the orientation for this scroll bar.

Since:
JDK1.1
See Also:
java.awt.Scrollbar#getOrientation

getValue

public int getValue()
Suppressed: Gets the current value of this scroll bar.

Specified by:
getValue in interface Adjustable
Returns:
the current value of this scroll bar
See Also:
java.awt.Scrollbar#getMinimum, java.awt.Scrollbar#getMaximum

setValue

public void setValue(int newValue)
Suppressed: Sets the value of this scroll bar to the specified value.

If the value supplied is less than the current minimum or greater than the current maximum - visibleAmount, then one of those values is substituted, as appropriate.

Normally, a program should change a scroll bar's value only by calling setValues. The setValues method simultaneously and synchronously sets the minimum, maximum, visible amount, and value properties of a scroll bar, so that they are mutually consistent.

Specified by:
setValue in interface Adjustable
Parameters:
newValue - the new value of the scroll bar
See Also:
java.awt.Scrollbar#setValues, java.awt.Scrollbar#getValue, java.awt.Scrollbar#getMinimum, java.awt.Scrollbar#getMaximum

getMinimum

public int getMinimum()
Suppressed: Gets the minimum value of this scroll bar.

Specified by:
getMinimum in interface Adjustable
Returns:
the minimum value of this scroll bar
See Also:
java.awt.Scrollbar#getValue, java.awt.Scrollbar#getMaximum

setMinimum

public void setMinimum(int newMinimum)
Suppressed: Sets the minimum value of this scroll bar.

When setMinimum is called, the limiting argument takes precedence over the existing scrollbar value.

Normally, a program should change a scroll bar's minimum value only by calling setValues. The setValues method simultaneously and synchronously sets the minimum, maximum, visible amount, and value properties of a scroll bar, so that they are mutually consistent.

Note that setting the minimum value to Integer.MIN_VALUE will result in the new minimum value to be set to Integer.MIN_VALUE - 1.

Specified by:
setMinimum in interface Adjustable
Parameters:
newMinimum - the new minimum value for this scroll bar
Since:
JDK1.1
See Also:
java.awt.Scrollbar#setValues, java.awt.Scrollbar#setMaximum

getMaximum

public int getMaximum()
Suppressed: Gets the maximum value of this scroll bar.

Specified by:
getMaximum in interface Adjustable
Returns:
the maximum value of this scroll bar
See Also:
java.awt.Scrollbar#getValue, java.awt.Scrollbar#getMinimum

setMaximum

public void setMaximum(int newMaximum)
Suppressed: Sets the maximum value of this scroll bar.

When setMaximum is called, the limiting argument takes precedence over the existing scrollbar value.

Normally, a program should change a scroll bar's maximum value only by calling setValues. The setValues method simultaneously and synchronously sets the minimum, maximum, visible amount, and value properties of a scroll bar, so that they are mutually consistent.

Specified by:
setMaximum in interface Adjustable
Parameters:
newMaximum - the new maximum value for this scroll bar
Since:
JDK1.1
See Also:
java.awt.Scrollbar#setValues, java.awt.Scrollbar#setMinimum

getVisibleAmount

public int getVisibleAmount()
Suppressed: Gets the visible amount of this scroll bar.

The visible amount of a scroll bar is the range of values represented by the width of the scroll bar's bubble.

Specified by:
getVisibleAmount in interface Adjustable
Returns:
the visible amount of this scroll bar
Since:
JDK1.1
See Also:
java.awt.Scrollbar#setVisibleAmount

getVisible

public int getVisible()
Suppressed: @deprecated As of JDK version 1.1, replaced by getVisibleAmount().


setVisibleAmount

public void setVisibleAmount(int newAmount)
Suppressed: Sets the visible amount of this scroll bar.

The visible amount of a scroll bar is the range of values represented by the width of the scroll bar's bubble.

Normally, a program should change a scroll bar's value only by calling setValues. The setValues method simultaneously and synchronously sets the minimum, maximum, visible amount, and value properties of a scroll bar, so that they are mutually consistent.

Specified by:
setVisibleAmount in interface Adjustable
Parameters:
newAmount - the amount visible per page
Since:
JDK1.1
See Also:
java.awt.Scrollbar#getVisibleAmount, java.awt.Scrollbar#setValues

setUnitIncrement

public void setUnitIncrement(int v)
Suppressed: Sets the unit increment for this scroll bar.

The unit increment is the value that is added (subtracted) when the user activates the unit increment area of the scroll bar, generally through a mouse or keyboard gesture that the scroll bar receives as an adjustment event.

Specified by:
setUnitIncrement in interface Adjustable
Parameters:
v - the amount by which to increment or decrement the scroll bar's value
Since:
JDK1.1
See Also:
java.awt.Scrollbar#getUnitIncrement

setLineIncrement

public void setLineIncrement(int v)
Suppressed: @deprecated As of JDK version 1.1, replaced by setUnitIncrement(int).


getUnitIncrement

public int getUnitIncrement()
Suppressed: Gets the unit increment for this scrollbar.

The unit increment is the value that is added (subtracted) when the user activates the unit increment area of the scroll bar, generally through a mouse or keyboard gesture that the scroll bar receives as an adjustment event.

Specified by:
getUnitIncrement in interface Adjustable
Returns:
the unit increment of this scroll bar
Since:
JDK1.1
See Also:
java.awt.Scrollbar#setUnitIncrement

getLineIncrement

public int getLineIncrement()
Suppressed: @deprecated As of JDK version 1.1, replaced by getUnitIncrement().


setBlockIncrement

public void setBlockIncrement(int v)
Suppressed: Sets the block increment for this scroll bar.

The block increment is the value that is added (subtracted) when the user activates the block increment area of the scroll bar, generally through a mouse or keyboard gesture that the scroll bar receives as an adjustment event.

Specified by:
setBlockIncrement in interface Adjustable
Parameters:
v - the amount by which to increment or decrement the scroll bar's value
Since:
JDK1.1
See Also:
java.awt.Scrollbar#getBlockIncrement

setPageIncrement

public void setPageIncrement(int v)
Suppressed: @deprecated As of JDK version 1.1, replaced by setBlockIncrement().


getBlockIncrement

public int getBlockIncrement()
Suppressed: Gets the block increment of this scroll bar.

The block increment is the value that is added (subtracted) when the user activates the block increment area of the scroll bar, generally through a mouse or keyboard gesture that the scroll bar receives as an adjustment event.

Specified by:
getBlockIncrement in interface Adjustable
Returns:
the block increment of this scroll bar
Since:
JDK1.1
See Also:
java.awt.Scrollbar#setBlockIncrement

getPageIncrement

public int getPageIncrement()
Suppressed: @deprecated As of JDK version 1.1, replaced by getBlockIncrement().


setValues

public void setValues(int value,
                      int visible,
                      int minimum,
                      int maximum)
Suppressed: Sets the values of four properties for this scroll bar: value, visibleAmount, minimum, and maximum. If the values supplied for these properties are inconsistent or incorrect, they will be changed to ensure consistency.

This method simultaneously and synchronously sets the values of four scroll bar properties, assuring that the values of these properties are mutually consistent. It enforces the following constraints: maximum must be greater than minimum, visibleAmount must be positive, visibleAmount must not be greater than maximum - minimum, value must not be less than minimum, and value must not be greater than maximum - visibleAmount

Parameters:
value - is the position in the current window
visible - is the amount visible per page
minimum - is the minimum value of the scroll bar
maximum - is the maximum value of the scroll bar
See Also:
setMinimum(int), setMaximum(int), setVisibleAmount(int), setValue(int)

getValueIsAdjusting

public boolean getValueIsAdjusting()
Suppressed: Returns true if the value is in the process of changing as a result of actions being taken by the user.

Returns:
the value of the valueIsAdjusting property
Since:
1.4
See Also:
setValueIsAdjusting(boolean)

setValueIsAdjusting

public void setValueIsAdjusting(boolean b)
Suppressed: Sets the valueIsAdjusting property.

Parameters:
b - new adjustment-in-progress status
Since:
1.4
See Also:
getValueIsAdjusting()

addAdjustmentListener

public void addAdjustmentListener(AdjustmentListener l)
Suppressed: Adds the specified adjustment listener to receive instances of AdjustmentEvent from this scroll bar. If l is null, no exception is thrown and no action is performed.

Specified by:
addAdjustmentListener in interface Adjustable
Parameters:
l - the adjustment listener
Since:
JDK1.1
See Also:
removeAdjustmentListener(java.awt.event.AdjustmentListener), getAdjustmentListeners(), java.awt.event.AdjustmentEvent, java.awt.event.AdjustmentListener

removeAdjustmentListener

public void removeAdjustmentListener(AdjustmentListener l)
Suppressed: Removes the specified adjustment listener so that it no longer receives instances of AdjustmentEvent from this scroll bar. If l is null, no exception is thrown and no action is performed.

Specified by:
removeAdjustmentListener in interface Adjustable
Parameters:
l - the adjustment listener
Since:
JDK1.1
See Also:
addAdjustmentListener(java.awt.event.AdjustmentListener), getAdjustmentListeners(), java.awt.event.AdjustmentEvent, java.awt.event.AdjustmentListener

getAdjustmentListeners

public AdjustmentListener[] getAdjustmentListeners()
Suppressed: Returns an array of all the adjustment listeners registered on this scrollbar.

Returns:
all of this scrollbar's AdjustmentListeners or an empty array if no adjustment listeners are currently registered
Since:
1.4
See Also:
addAdjustmentListener(java.awt.event.AdjustmentListener), removeAdjustmentListener(java.awt.event.AdjustmentListener), java.awt.event.AdjustmentEvent, java.awt.event.AdjustmentListener

getListeners

public EventListener[] getListeners(Class listenerType)
Suppressed: Returns an array of all the objects currently registered as FooListeners upon this Scrollbar. FooListeners are registered using the addFooListener method.

You can specify the listenerType argument with a class literal, such as FooListener.class. For example, you can query a Scrollbar c for its mouse listeners with the following code:

MouseListener[] mls = (MouseListener[])(c.getListeners(MouseListener.class));
If no such listeners exist, this method returns an empty array.

Overrides:
getListeners in class Component
Parameters:
listenerType - the type of listeners requested; this parameter should specify an interface that descends from java.util.EventListener
Returns:
an array of all objects registered as FooListeners on this component, or an empty array if no such listeners have been added
Since:
1.3
See Also:
Component.getComponentListeners(), Component.getFocusListeners(), Component.getHierarchyListeners(), Component.getHierarchyBoundsListeners(), Component.getKeyListeners(), Component.getMouseListeners(), Component.getMouseMotionListeners(), Component.getMouseWheelListeners(), Component.getInputMethodListeners(), Component.getPropertyChangeListeners()

eventEnabled

boolean eventEnabled(AWTEvent e)
Overrides:
eventEnabled in class Component

processEvent

protected void processEvent(AWTEvent e)
Processes events on this scroll bar. If the event is an instance of AdjustmentEvent, it invokes the processAdjustmentEvent method. Otherwise, it invokes its superclass's processEvent method.

Note that if the event parameter is null the behavior is unspecified and may result in an exception.

Overrides:
processEvent in class Component
Parameters:
e - the event
Since:
JDK1.1
See Also:
java.awt.event.AdjustmentEvent, java.awt.Scrollbar#processAdjustmentEvent

processAdjustmentEvent

protected void processAdjustmentEvent(AdjustmentEvent e)
Processes adjustment events occurring on this scrollbar by dispatching them to any registered AdjustmentListener objects.

This method is not called unless adjustment events are enabled for this component. Adjustment events are enabled when one of the following occurs:

Note that if the event parameter is null the behavior is unspecified and may result in an exception.

Parameters:
e - the adjustment event
Since:
JDK1.1
See Also:
java.awt.event.AdjustmentEvent, java.awt.event.AdjustmentListener, java.awt.Scrollbar#addAdjustmentListener, java.awt.Component#enableEvents

paramString

protected String paramString()
Returns a string representing the state of this Scrollbar. This method is intended to be used only for debugging purposes, and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null.

Overrides:
paramString in class Component
Returns:
the parameter string of this scroll bar

writeObject

private void writeObject(ObjectOutputStream s)
                  throws IOException
Writes default serializable fields to stream. Writes a list of serializable AdjustmentListeners as optional data. The non-serializable listeners are detected and no attempt is made to serialize them.

Parameters:
s - the ObjectOutputStream to write
IOException
See Also:
AWTEventMulticaster.save(ObjectOutputStream, String, EventListener), java.awt.Component.adjustmentListenerK, writeObject(java.io.ObjectOutputStream)

readObject

private void readObject(ObjectInputStream s)
                 throws ClassNotFoundException,
                        IOException,
                        HeadlessException
Reads the ObjectInputStream and if it isn't null adds a listener to receive adjustment events fired by the Scrollbar. Unrecognized keys or values will be ignored.

Parameters:
s - the ObjectInputStream to read
ClassNotFoundException
IOException
HeadlessException
See Also:
java.awt.GraphicsEnvironment#isHeadless, writeObject(java.io.ObjectOutputStream)

getAccessibleContext

public AccessibleContext getAccessibleContext()
Suppressed: Gets the AccessibleContext associated with this Scrollbar. For scrollbars, the AccessibleContext takes the form of an AccessibleAWTScrollBar. A new AccessibleAWTScrollBar instance is created if necessary.

Specified by:
getAccessibleContext in interface Accessible
Overrides:
getAccessibleContext in class Component
Returns:
an AccessibleAWTScrollBar that serves as the AccessibleContext of this ScrollBar


comments?