- All Implemented Interfaces:
- Adjustable,- ImageObserver,- MenuContainer,- Serializable,- Accessible
Scrollbar class embodies a scroll bar, a
 familiar user-interface object. A scroll bar provides a
 convenient means for allowing a user to select from a
 range of values. The following three vertical
 scroll bars could be used as slider controls to pick
 the red, green, and blue components of a color:
 
  
 
Each scroll bar in this example could be created with code similar to the following:
redSlider=new Scrollbar(Scrollbar.VERTICAL, 0, 1, 0, 255); add(redSlider);
Alternatively, a scroll bar can represent a range of values. For example, if a scroll bar is used for scrolling through text, the width of the "bubble" (also called the "thumb" or "scroll box") can be used to represent the amount of text that is visible. Here is an example of a scroll bar that represents a range:
  
 
The value range represented by the bubble in this example is the visible amount. The horizontal scroll bar in this example could be created with code like the following:
ranger = new Scrollbar(Scrollbar.HORIZONTAL, 0, 60, 0, 300); add(ranger);
 Note that the actual maximum value of the scroll bar is the
 maximum minus the visible amount.
 In the previous example, because the maximum is
 300 and the visible amount is 60, the actual maximum
 value is 240.  The range of the scrollbar track is 0 - 300.
 The left side of the bubble indicates the value of the
 scroll bar.
 
Normally, the user changes the value of the scroll bar by making a gesture with the mouse. For example, the user can drag the scroll bar's bubble up and down, or click in the scroll bar's unit increment or block increment areas. Keyboard gestures can also be mapped to the scroll bar. By convention, the Page Up and Page Down keys are equivalent to clicking in the scroll bar's block increment and block decrement areas.
 When the user changes the value of the scroll bar, the scroll bar
 receives an instance of AdjustmentEvent.
 The scroll bar processes this event, passing it along to
 any registered listeners.
 
 Any object that wishes to be notified of changes to the
 scroll bar's value should implement
 AdjustmentListener, an interface defined in
 the package java.awt.event.
 Listeners can be added and removed dynamically by calling
 the methods addAdjustmentListener and
 removeAdjustmentListener.
 
 The AdjustmentEvent class defines five types
 of adjustment event, listed here:
 
- AdjustmentEvent.TRACKis sent out when the user drags the scroll bar's bubble.
- AdjustmentEvent.UNIT_INCREMENTis sent out when the user clicks in the left arrow of a horizontal scroll bar, or the top arrow of a vertical scroll bar, or makes the equivalent gesture from the keyboard.
- AdjustmentEvent.UNIT_DECREMENTis sent out when the user clicks in the right arrow of a horizontal scroll bar, or the bottom arrow of a vertical scroll bar, or makes the equivalent gesture from the keyboard.
- AdjustmentEvent.BLOCK_INCREMENTis sent out when the user clicks in the track, to the left of the bubble on a horizontal scroll bar, or above the bubble on a vertical scroll bar. By convention, the Page Up key is equivalent, if the user is using a keyboard that defines a Page Up key.
- AdjustmentEvent.BLOCK_DECREMENTis sent out when the user clicks in the track, to the right of the bubble on a horizontal scroll bar, or below the bubble on a vertical scroll bar. By convention, the Page Down key is equivalent, if the user is using a keyboard that defines a Page Down key.
The JDK 1.0 event system is supported for backwards compatibility, but its use with newer versions of the platform is discouraged. The five types of adjustment events introduced with JDK 1.1 correspond to the five event types that are associated with scroll bars in previous platform versions. The following list gives the adjustment event type, and the corresponding JDK 1.0 event type it replaces.
- AdjustmentEvent.TRACKreplaces- Event.SCROLL_ABSOLUTE
- AdjustmentEvent.UNIT_INCREMENTreplaces- Event.SCROLL_LINE_UP
- AdjustmentEvent.UNIT_DECREMENTreplaces- Event.SCROLL_LINE_DOWN
- AdjustmentEvent.BLOCK_INCREMENTreplaces- Event.SCROLL_PAGE_UP
- AdjustmentEvent.BLOCK_DECREMENTreplaces- Event.SCROLL_PAGE_DOWN
 Note: We recommend using a Scrollbar
 for value selection only.  If you want to implement
 a scrollable component inside a container, we recommend you use
 a ScrollPane. If you use a
 Scrollbar for this purpose, you are likely to
 encounter issues with painting, key handling, sizing and
 positioning.
- Since:
- 1.0
- See Also:
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionprotected classThis class implements accessibility support for theScrollbarclass.Nested classes/interfaces declared in class java.awt.ComponentComponent.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final intA constant that indicates a horizontal scroll bar.static final intA constant that indicates a vertical scroll bar.Fields declared in class java.awt.ComponentaccessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields declared in interface java.awt.AdjustableNO_ORIENTATIONFields declared in interface java.awt.image.ImageObserverABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
- 
Constructor SummaryConstructorsConstructorDescriptionConstructs a new vertical scroll bar.Scrollbar(int orientation) Constructs a new scroll bar with the specified orientation.Scrollbar(int orientation, int value, int visible, int minimum, int maximum) Constructs a new scroll bar with the specified orientation, initial value, visible amount, and minimum and maximum values.
- 
Method SummaryModifier and TypeMethodDescriptionvoidAdds the specified adjustment listener to receive instances ofAdjustmentEventfrom this scroll bar.voidCreates theScrollbar's peer.Gets theAccessibleContextassociated with thisScrollbar.Returns an array of all the adjustment listeners registered on this scrollbar.intGets the block increment of this scroll bar.intDeprecated.<T extends EventListener>
 T[]getListeners(Class<T> listenerType) Returns an array of all the objects currently registered asFooListeners upon thisScrollbar.intGets the maximum value of this scroll bar.intGets the minimum value of this scroll bar.intReturns the orientation of this scroll bar.intDeprecated.As of JDK version 1.1, replaced bygetBlockIncrement().intGets the unit increment for this scrollbar.intgetValue()Gets the current value of this scroll bar.booleanReturns true if the value is in the process of changing as a result of actions being taken by the user.intDeprecated.As of JDK version 1.1, replaced bygetVisibleAmount().intGets the visible amount of this scroll bar.protected StringReturns a string representing the state of thisScrollbar.protected voidProcesses adjustment events occurring on this scrollbar by dispatching them to any registeredAdjustmentListenerobjects.protected voidProcesses events on this scroll bar.voidRemoves the specified adjustment listener so that it no longer receives instances ofAdjustmentEventfrom this scroll bar.voidsetBlockIncrement(int v) Sets the block increment for this scroll bar.voidsetLineIncrement(int v) Deprecated.As of JDK version 1.1, replaced bysetUnitIncrement(int).voidsetMaximum(int newMaximum) Sets the maximum value of this scroll bar.voidsetMinimum(int newMinimum) Sets the minimum value of this scroll bar.voidsetOrientation(int orientation) Sets the orientation for this scroll bar.voidsetPageIncrement(int v) Deprecated.As of JDK version 1.1, replaced bysetBlockIncrement().voidsetUnitIncrement(int v) Sets the unit increment for this scroll bar.voidsetValue(int newValue) Sets the value of this scroll bar to the specified value.voidsetValueIsAdjusting(boolean b) Sets thevalueIsAdjustingproperty.voidsetValues(int value, int visible, int minimum, int maximum) Sets the values of four properties for this scroll bar:value,visibleAmount,minimum, andmaximum.voidsetVisibleAmount(int newAmount) Sets the visible amount of this scroll bar.Methods declared in class java.awt.Componentaction, 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, getBaseline, getBaselineResizeBehavior, 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, 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, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, revalidate, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setMixingCutoutShape, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, update, validate
- 
Field Details- 
HORIZONTALpublic static final int HORIZONTALA constant that indicates a horizontal scroll bar.- See Also:
 
- 
VERTICALpublic static final int VERTICALA constant that indicates a vertical scroll bar.- See Also:
 
 
- 
- 
Constructor Details- 
ScrollbarConstructs a new vertical scroll bar. The default properties of the scroll bar are listed in the following table:Scrollbar default properties Property Description Default Value orientation indicates whether the scroll bar is vertical or horizontal Scrollbar.VERTICALvalue value which controls the location of the scroll bar's bubble 0 visible amount visible amount of the scroll bar's range, typically represented by the size of the scroll bar's bubble 10 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 bubble10 - Throws:
- HeadlessException- if GraphicsEnvironment.isHeadless() returns true.
- See Also:
 
- 
ScrollbarConstructs a new scroll bar with the specified orientation.The orientationargument must take one of the two valuesScrollbar.HORIZONTAL, orScrollbar.VERTICAL, indicating a horizontal or vertical scroll bar, respectively.- Parameters:
- orientation- indicates the orientation of the scroll bar
- Throws:
- IllegalArgumentException- when an illegal value for the- orientationargument is supplied
- HeadlessException- if GraphicsEnvironment.isHeadless() returns true.
- See Also:
 
- 
Scrollbarpublic Scrollbar(int orientation, int value, int visible, int minimum, int maximum) throws HeadlessException Constructs a new scroll bar with the specified orientation, initial value, visible amount, and minimum and maximum values.The orientationargument must take one of the two valuesScrollbar.HORIZONTAL, orScrollbar.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 visible amount of the scroll bar, typically represented by the size of the bubble
- minimum- the minimum value of the scroll bar
- maximum- the maximum value of the scroll bar
- Throws:
- IllegalArgumentException- when an illegal value for the- orientationargument is supplied
- HeadlessException- if GraphicsEnvironment.isHeadless() returns true.
- See Also:
 
 
- 
- 
Method Details- 
addNotifypublic void addNotify()Creates theScrollbar's peer. The peer allows you to modify the appearance of theScrollbarwithout changing any of its functionality.
- 
getOrientationpublic int getOrientation()Returns the orientation of this scroll bar.- Specified by:
- getOrientationin interface- Adjustable
- Returns:
- the orientation of this scroll bar, either
               Scrollbar.HORIZONTALorScrollbar.VERTICAL
- See Also:
 
- 
setOrientationpublic void setOrientation(int orientation) Sets the orientation for this scroll bar.- Parameters:
- orientation- the orientation of this scroll bar, either- Scrollbar.HORIZONTALor- Scrollbar.VERTICAL
- Throws:
- IllegalArgumentException- if the value supplied for- orientationis not a legal value
- Since:
- 1.1
- See Also:
 
- 
getValuepublic int getValue()Gets the current value of this scroll bar.- Specified by:
- getValuein interface- Adjustable
- Returns:
- the current value of this scroll bar
- See Also:
 
- 
setValuepublic void setValue(int newValue) Sets the value of this scroll bar to the specified value.If the value supplied is less than the current minimumor greater than the currentmaximum - visibleAmount, then eitherminimumormaximum - visibleAmountis substituted, as appropriate.Normally, a program should change a scroll bar's value only by calling setValues. ThesetValuesmethod simultaneously and synchronously sets the minimum, maximum, visible amount, and value properties of a scroll bar, so that they are mutually consistent.Calling this method does not fire an AdjustmentEvent.- Specified by:
- setValuein interface- Adjustable
- Parameters:
- newValue- the new value of the scroll bar
- See Also:
 
- 
getMinimumpublic int getMinimum()Gets the minimum value of this scroll bar.- Specified by:
- getMinimumin interface- Adjustable
- Returns:
- the minimum value of this scroll bar
- See Also:
 
- 
setMinimumpublic void setMinimum(int newMinimum) Sets the minimum value of this scroll bar.When setMinimumis called, the minimum value is changed, and other values (including the maximum, the visible amount, and the current scroll bar value) are changed to be consistent with the new minimum.Normally, a program should change a scroll bar's minimum value only by calling setValues. ThesetValuesmethod 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.MAX_VALUEwill result in the new minimum value being set toInteger.MAX_VALUE - 1.- Specified by:
- setMinimumin interface- Adjustable
- Parameters:
- newMinimum- the new minimum value for this scroll bar
- Since:
- 1.1
- See Also:
 
- 
getMaximumpublic int getMaximum()Gets the maximum value of this scroll bar.- Specified by:
- getMaximumin interface- Adjustable
- Returns:
- the maximum value of this scroll bar
- See Also:
 
- 
setMaximumpublic void setMaximum(int newMaximum) Sets the maximum value of this scroll bar.When setMaximumis called, the maximum value is changed, and other values (including the minimum, the visible amount, and the current scroll bar value) are changed to be consistent with the new maximum.Normally, a program should change a scroll bar's maximum value only by calling setValues. ThesetValuesmethod 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 maximum value to Integer.MIN_VALUEwill result in the new maximum value being set toInteger.MIN_VALUE + 1.- Specified by:
- setMaximumin interface- Adjustable
- Parameters:
- newMaximum- the new maximum value for this scroll bar
- Since:
- 1.1
- See Also:
 
- 
getVisibleAmountpublic int getVisibleAmount()Gets the visible amount of this scroll bar.When a scroll bar is used to select a range of values, the visible amount is used to represent the range of values that are currently visible. The size of the scroll bar's bubble (also called a thumb or scroll box), usually gives a visual representation of the relationship of the visible amount to the range of the scroll bar. Note that depending on platform, the value of the visible amount property may not be visually indicated by the size of the bubble. The scroll bar's bubble may not be displayed when it is not moveable (e.g. when it takes up the entire length of the scroll bar's track, or when the scroll bar is disabled). Whether the bubble is displayed or not will not affect the value returned by getVisibleAmount.- Specified by:
- getVisibleAmountin interface- Adjustable
- Returns:
- the visible amount of this scroll bar
- Since:
- 1.1
- See Also:
 
- 
getVisibleDeprecated.As of JDK version 1.1, replaced bygetVisibleAmount().Returns the visible amount of this scroll bar.- Returns:
- the visible amount of this scroll bar
 
- 
setVisibleAmountpublic void setVisibleAmount(int newAmount) Sets the visible amount of this scroll bar.When a scroll bar is used to select a range of values, the visible amount is used to represent the range of values that are currently visible. The size of the scroll bar's bubble (also called a thumb or scroll box), usually gives a visual representation of the relationship of the visible amount to the range of the scroll bar. Note that depending on platform, the value of the visible amount property may not be visually indicated by the size of the bubble. The scroll bar's bubble may not be displayed when it is not moveable (e.g. when it takes up the entire length of the scroll bar's track, or when the scroll bar is disabled). Whether the bubble is displayed or not will not affect the value returned by getVisibleAmount.If the visible amount supplied is less than oneor greater than the currentmaximum - minimum, then eitheroneormaximum - minimumis substituted, as appropriate.Normally, a program should change a scroll bar's value only by calling setValues. ThesetValuesmethod simultaneously and synchronously sets the minimum, maximum, visible amount, and value properties of a scroll bar, so that they are mutually consistent.- Specified by:
- setVisibleAmountin interface- Adjustable
- Parameters:
- newAmount- the new visible amount
- Since:
- 1.1
- See Also:
 
- 
setUnitIncrementpublic void setUnitIncrement(int v) Sets the unit increment for this scroll bar.The unit increment is the value that is added or 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. The unit increment must be greater than zero. Attempts to set the unit increment to a value lower than 1 will result in a value of 1 being set. In some operating systems, this property can be ignored by the underlying controls. - Specified by:
- setUnitIncrementin interface- Adjustable
- Parameters:
- v- the amount by which to increment or decrement the scroll bar's value
- Since:
- 1.1
- See Also:
 
- 
setLineIncrementDeprecated.As of JDK version 1.1, replaced bysetUnitIncrement(int).Sets the unit increment for this scroll bar.- Parameters:
- v- the increment value
 
- 
getUnitIncrementpublic int getUnitIncrement()Gets the unit increment for this scrollbar.The unit increment is the value that is added or 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. The unit increment must be greater than zero. In some operating systems, this property can be ignored by the underlying controls. - Specified by:
- getUnitIncrementin interface- Adjustable
- Returns:
- the unit increment of this scroll bar
- Since:
- 1.1
- See Also:
 
- 
getLineIncrementDeprecated.As of JDK version 1.1, replaced bygetUnitIncrement().Returns the unit increment for this scrollbar.- Returns:
- the unit increment for this scrollbar
 
- 
setBlockIncrementpublic void setBlockIncrement(int v) Sets the block increment for this scroll bar.The block increment is the value that is added or 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. The block increment must be greater than zero. Attempts to set the block increment to a value lower than 1 will result in a value of 1 being set. - Specified by:
- setBlockIncrementin interface- Adjustable
- Parameters:
- v- the amount by which to increment or decrement the scroll bar's value
- Since:
- 1.1
- See Also:
 
- 
setPageIncrementDeprecated.As of JDK version 1.1, replaced bysetBlockIncrement().Sets the block increment for this scroll bar.- Parameters:
- v- the block increment
 
- 
getBlockIncrementpublic int getBlockIncrement()Gets the block increment of this scroll bar.The block increment is the value that is added or 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. The block increment must be greater than zero. - Specified by:
- getBlockIncrementin interface- Adjustable
- Returns:
- the block increment of this scroll bar
- Since:
- 1.1
- See Also:
 
- 
getPageIncrementDeprecated.As of JDK version 1.1, replaced bygetBlockIncrement().Returns the block increment of this scroll bar.- Returns:
- the block increment of this scroll bar
 
- 
setValuespublic void setValues(int value, int visible, int minimum, int maximum) Sets the values of four properties for this scroll bar:value,visibleAmount,minimum, andmaximum. 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: maximummust be greater thanminimum,maximum - minimummust not be greater thanInteger.MAX_VALUE,visibleAmountmust be greater than zero.visibleAmountmust not be greater thanmaximum - minimum,valuemust not be less thanminimum, andvaluemust not be greater thanmaximum - visibleAmountCalling this method does not fire an AdjustmentEvent.- Parameters:
- value- is the position in the current window
- visible- is the visible amount of the scroll bar
- minimum- is the minimum value of the scroll bar
- maximum- is the maximum value of the scroll bar
- See Also:
 
- 
getValueIsAdjustingpublic boolean getValueIsAdjusting()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 valueIsAdjustingproperty
- Since:
- 1.4
- See Also:
 
- 
setValueIsAdjustingpublic void setValueIsAdjusting(boolean b) Sets thevalueIsAdjustingproperty.- Parameters:
- b- new adjustment-in-progress status
- Since:
- 1.4
- See Also:
 
- 
addAdjustmentListenerAdds the specified adjustment listener to receive instances ofAdjustmentEventfrom this scroll bar. If l isnull, no exception is thrown and no action is performed.Refer to AWT Threading Issues for details on AWT's threading model. - Specified by:
- addAdjustmentListenerin interface- Adjustable
- Parameters:
- l- the adjustment listener
- Since:
- 1.1
- See Also:
 
- 
removeAdjustmentListenerRemoves the specified adjustment listener so that it no longer receives instances ofAdjustmentEventfrom this scroll bar. If l isnull, no exception is thrown and no action is performed.Refer to AWT Threading Issues for details on AWT's threading model. - Specified by:
- removeAdjustmentListenerin interface- Adjustable
- Parameters:
- l- the adjustment listener
- Since:
- 1.1
- See Also:
 
- 
getAdjustmentListenersReturns 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:
 
- 
getListenersReturns an array of all the objects currently registered asFooListeners upon thisScrollbar.FooListeners are registered using theaddFooListenermethod.You can specify the listenerTypeargument with a class literal, such asFooListener.class. For example, you can query aScrollbar cfor 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:
- getListenersin class- Component
- Type Parameters:
- T- the type of the listeners
- 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
- Throws:
- ClassCastException- if- listenerTypedoesn't specify a class or interface that implements- java.util.EventListener
- Since:
- 1.3
- See Also:
 
- 
processEventProcesses events on this scroll bar. If the event is an instance ofAdjustmentEvent, it invokes theprocessAdjustmentEventmethod. Otherwise, it invokes its superclass'sprocessEventmethod.Note that if the event parameter is nullthe behavior is unspecified and may result in an exception.- Overrides:
- processEventin class- Component
- Parameters:
- e- the event
- Since:
- 1.1
- See Also:
 
- 
processAdjustmentEventProcesses adjustment events occurring on this scrollbar by dispatching them to any registeredAdjustmentListenerobjects.This method is not called unless adjustment events are enabled for this component. Adjustment events are enabled when one of the following occurs: - An AdjustmentListenerobject is registered viaaddAdjustmentListener.
- Adjustment events are enabled via enableEvents.
 Note that if the event parameter is nullthe behavior is unspecified and may result in an exception.- Parameters:
- e- the adjustment event
- Since:
- 1.1
- See Also:
 
- An 
- 
paramStringReturns a string representing the state of thisScrollbar. 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 benull.- Overrides:
- paramStringin class- Component
- Returns:
- the parameter string of this scroll bar
 
- 
getAccessibleContextGets theAccessibleContextassociated with thisScrollbar. For scrollbars, theAccessibleContexttakes the form of anAccessibleAWTScrollBar. A newAccessibleAWTScrollBarinstance is created if necessary.- Specified by:
- getAccessibleContextin interface- Accessible
- Overrides:
- getAccessibleContextin class- Component
- Returns:
- an AccessibleAWTScrollBarthat serves as theAccessibleContextof thisScrollBar
- Since:
- 1.3
 
 
- 
getUnitIncrement().