All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Scrollbar
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" or "thumb" can 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 is the visible range of the scroll bar. The horizontal scroll bar in this example could be created with code like the following:
ranger = new Scrollbar(Scrollbar.HORIZONTAL, 0, 64, 0, 255); add(ranger);
Note that the maximum value above, 255, is the maximum value for the scroll bar's bubble. The actual width of the scroll bar's track is 255 + 64. When the scroll bar is set to its maximum value, the left side of the bubble is at 255, and the right side is at 255 + 64.
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.TRACK is sent out when the 
 user drags the scroll bar's bubble.
 AdjustmentEvent.UNIT_INCREMENT is 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_DECREMENT is 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_INCREMENT is 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_DECREMENT is 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 JDK is discouraged. The fives types of adjustment event introduced with JDK 1.1 correspond to the five event types that are associated with scroll bars in previous JDK versions. The following list gives the adjustment event type, and the corresponding JDK 1.0 event type it replaces.
AdjustmentEvent.TRACK replaces 
 Event.SCROLL_ABSOLUTE
 AdjustmentEvent.UNIT_INCREMENT replaces 
 Event.SCROLL_LINE_UP
 AdjustmentEvent.UNIT_DECREMENT replaces 
 Event.SCROLL_LINE_DOWN
 AdjustmentEvent.BLOCK_INCREMENT replaces 
 Event.SCROLL_PAGE_UP
 AdjustmentEvent.BLOCK_DECREMENT replaces 
 Event.SCROLL_PAGE_DOWN
 
 
 HORIZONTAL
	HORIZONTAL
   VERTICAL
	VERTICAL
   
 Scrollbar()
	Scrollbar()
   Scrollbar(int)
	Scrollbar(int)
   Scrollbar(int, int, int, int, int)
	Scrollbar(int, int, int, int, int)
   
 addAdjustmentListener(AdjustmentListener)
	addAdjustmentListener(AdjustmentListener)
  AdjustmentEvent from this scroll bar.
   addNotify()
	addNotify()
   getBlockIncrement()
	getBlockIncrement()
   getLineIncrement()
	getLineIncrement()
   getMaximum()
	getMaximum()
   getMinimum()
	getMinimum()
   getOrientation()
	getOrientation()
   getPageIncrement()
	getPageIncrement()
   getUnitIncrement()
	getUnitIncrement()
   getValue()
	getValue()
   getVisible()
	getVisible()
   getVisibleAmount()
	getVisibleAmount()
   paramString()
	paramString()
   processAdjustmentEvent(AdjustmentEvent)
	processAdjustmentEvent(AdjustmentEvent)
  AdjustmentListener objects.
   processEvent(AWTEvent)
	processEvent(AWTEvent)
   removeAdjustmentListener(AdjustmentListener)
	removeAdjustmentListener(AdjustmentListener)
  AdjustmentEvent from this scroll bar.
   setBlockIncrement(int)
	setBlockIncrement(int)
   setLineIncrement(int)
	setLineIncrement(int)
   setMaximum(int)
	setMaximum(int)
   setMinimum(int)
	setMinimum(int)
   setOrientation(int)
	setOrientation(int)
   setPageIncrement(int)
	setPageIncrement(int)
   setUnitIncrement(int)
	setUnitIncrement(int)
   setValue(int)
	setValue(int)
   setValues(int, int, int, int)
	setValues(int, int, int, int)
   setVisibleAmount(int)
	setVisibleAmount(int)
   
 HORIZONTAL
HORIZONTAL
public static final int HORIZONTAL
 VERTICAL
VERTICAL
public static final int VERTICAL
 
 Scrollbar
Scrollbar
public Scrollbar()
 Scrollbar
Scrollbar
public Scrollbar(int orientation)
 The orientation argument must take one of the two 
 values Scrollbar.HORIZONTAL, 
 or Scrollbar.VERTICAL, 
 indicating a horizontal or vertical scroll bar, respectively.
orientation argument is supplied.
   Scrollbar
Scrollbar
 public Scrollbar(int orientation,
                  int value,
                  int visible,
                  int minimum,
                  int maximum)
 The orientation argument must take one of the two 
 values Scrollbar.HORIZONTAL, 
 or Scrollbar.VERTICAL, 
 indicating a horizontal or vertical scroll bar, respectively. 
 
If the specified maximum value is less than the minimum value, it is changed to be the same as the minimum value. If the initial value is lower than the minimum value, it is changed to be the minimum value; if it is greater than the maximum value, it is changed to be the maximum value.
 
 addNotify
addNotify
public void addNotify()
 getOrientation
getOrientation
public int getOrientation()
Scrollbar.HORIZONTAL or 
               Scrollbar.VERTICAL.
     setOrientation
setOrientation
public void setOrientation(int orientation)
Scrollbar.HORIZONTAL or 
               Scrollbar.VERTICAL.
    orientation is not a
                   legal value.
     getValue
getValue
public int getValue()
 setValue
setValue
public synchronized void setValue(int newValue)
If the value supplied is less than the current minimum or greater than the current maximum, 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.
 getMinimum
getMinimum
public int getMinimum()
 setMinimum
setMinimum
public synchronized void setMinimum(int newMinimum)
 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.
 getMaximum
getMaximum
public int getMaximum()
 setMaximum
setMaximum
public synchronized void setMaximum(int newMaximum)
 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.
 getVisibleAmount
getVisibleAmount
public int getVisibleAmount()
The visible amount of a scroll bar is the range of values represented by the width of the scroll bar's bubble. It is used to determine the scroll bar's block increment.
 getVisible
getVisible
public int getVisible()
getVisibleAmount().
 setVisibleAmount
setVisibleAmount
public synchronized void setVisibleAmount(int newAmount)
The visible amount of a scroll bar is the range of values represented by the width of the scroll bar's bubble. It is used to determine the scroll bar's block increment.
 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.
 setUnitIncrement
setUnitIncrement
public synchronized void setUnitIncrement(int v)
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.
 setLineIncrement
setLineIncrement
public void setLineIncrement(int v)
setUnitIncrement(int).
 getUnitIncrement
getUnitIncrement
public int getUnitIncrement()
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.
 getLineIncrement
getLineIncrement
public int getLineIncrement()
getUnitIncrement().
 setBlockIncrement
setBlockIncrement
public synchronized void setBlockIncrement(int v)
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.
 setPageIncrement
setPageIncrement
public void setPageIncrement(int v)
setBlockIncrement().
 getBlockIncrement
getBlockIncrement
public int getBlockIncrement()
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.
 getPageIncrement
getPageIncrement
public int getPageIncrement()
getBlockIncrement().
 setValues
setValues
 public synchronized void setValues(int value,
                                    int visible,
                                    int minimum,
                                    int maximum)
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 constraints that maximum cannot be less than minimum, and that value cannot be less than the minimum or greater than the maximum.
 addAdjustmentListener
addAdjustmentListener
public synchronized void addAdjustmentListener(AdjustmentListener l)
AdjustmentEvent from this scroll bar.
 removeAdjustmentListener
removeAdjustmentListener
public synchronized void removeAdjustmentListener(AdjustmentListener l)
AdjustmentEvent from this scroll bar.
 processEvent
processEvent
protected void processEvent(AWTEvent e)
AdjustmentEvent, it invokes the 
 processAdjustmentEvent method. 
 Otherwise, it invokes its superclass's 
 processEvent method.
 processAdjustmentEvent
processAdjustmentEvent
protected void processAdjustmentEvent(AdjustmentEvent e)
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:
AdjustmentListener object is registered 
 via addAdjustmentListener.
 enableEvents.
 
 paramString
paramString
protected String paramString()
All Packages Class Hierarchy This Package Previous Next Index