dog.gui
Class DScrollbar

java.lang.Object
  |
  +--java.awt.Component
        |
        +--dog.gui.DComponent
              |
              +--dog.gui.DScrollbar
All Implemented Interfaces:
java.awt.Adjustable, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, Referential, java.io.Serializable, TimerListener

public class DScrollbar
extends DComponent
implements java.awt.Adjustable, TimerListener

An adjustable scrollbar component.

The scrollbar can be in one of two orientations: horizontal or vertical. In horizontal mode, it indicates its value from left to right; in vertical, from top to bottom.

See Also:
Serialized Form

Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent
 
Field Summary
protected  java.awt.event.AdjustmentListener adjustmentListener
           
protected  int blockIncrement
          The amount by which the scrollbar value will change when the user clicks above or below the block indicator.
protected  boolean dimpled
          Whether to draw a NeXT-like dimple on the scrollbar.
static int HORIZONTAL
          The horizontal scrollbar variable.
protected  int maximum
          The maximum value of the scrollbar.
protected  int minimum
          The minimum value of the scrollbar.
protected  int orientation
          The scrollbar's orientation, either horizontal or vertical.
protected static int PREFERREDWIDTH
          The preferred width for scrollbars.
protected  java.lang.Object reference
          The object reference.
protected  int unitIncrement
          The amount by which the scrollbar value will change when the user clicks one of the up or down buttons.
protected  int value
          The value of the scrollbar.
static int VERTICAL
          The vertical scrollbar variable.
protected  int visibleAmount
          The size of the visible portion of the scrollbar.
 
Fields inherited from class dog.gui.DComponent
CENTER, CENTER_TILE, changes, EAST, INTEGER_TILE, MAXIMIZE, MAXIMIZE_ASPECT, MAXIMIZE_HORIZONTAL, MAXIMIZE_VERTICAL, NORTH, NORTHEAST, NORTHWEST, SOUTH, SOUTHEAST, SOUTHWEST, TILE, tooltip, WEST
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
DScrollbar()
          Constructs a new vertical scrollbar.
DScrollbar(int orientation)
          Constructs a new scrollbar with the specified orientation.
DScrollbar(int orientation, int value, int visibleAmount, int minimum, int maximum)
          Constructs a new scrollbar with the specified orientation, value, page size, and minumum and maximum values.
 
Method Summary
 void addAdjustmentListener(java.awt.event.AdjustmentListener listener)
          Adds the specified adjustment listener to receive adjustment events from this scrollbar.
 int getBlockIncrement()
          Gets the block increment for this scrollbar.
 int getMaximum()
          Returns the maximum value of this scrollbar.
 int getMinimum()
          Returns the minimum value of this scrollbar.
 int getOrientation()
          Returns the orientation for this scrollbar.
 java.awt.Dimension getPreferredSize()
          Returns the preferred size of a scrollbar.
 java.lang.Object getReference()
          Returns the object reference.
 int getUnitIncrement()
          Gets the unit increment for this scrollbar.
 int getValue()
          Returns the current value of this scrollbar.
 int getVisibleAmount()
          Returns the visible amount of this scrollbar.
 boolean isDimpled()
          Indicates whether to draw a dimple on the scrollbar.
 boolean isDragging()
          Indicates whether this scrollbar's value is being dragged by the user.
 void paint(java.awt.Graphics g)
          Paints this scrollbar.
protected  java.lang.String paramString()
          Returns the String parameters for this scrollbar.
protected  void processAdjustmentEvent(java.awt.event.AdjustmentEvent event)
          Processes adjustment events on this scrollbar by dispatching them to any registered AdjustmentListener objects.
protected  void processEvent(java.awt.AWTEvent event)
          Processes events on this scrollbar.
protected  void processMouseEvent(java.awt.event.MouseEvent event)
          Processes mouse events on this scrollbar by dispatching them to any registered MouseListener objects.
protected  void processMouseMotionEvent(java.awt.event.MouseEvent event)
          Processes mouse motion events on this scrollbar by dispatching them to any registered MouseMotionListener objects.
 void removeAdjustmentListener(java.awt.event.AdjustmentListener listener)
          Removes the specified adjustment listener so that it no longer receives adjustment events from this scrollbar.
 void setBlockIncrement(int blockIncrement)
          Sets the block increment for this scrollbar.
 void setDimpled(boolean flag)
          Sets whether to draw a dimple on the scrollbar.
 void setMaximum(int maximum)
          Sets the maximum value for this scrollbar.
 void setMinimum(int minimum)
          Sets the minimum value for this scrollbar.
 void setOrientation(int orientation)
          Sets the orientation for this scrollbar.
 void setParameters(int minimum, int maximum, int visibleAmount, int unitIncrement, int blockIncrement)
          Sets the parameters for this scrollbar.
 void setReference(java.lang.Object reference)
          Sets the object reference.
 void setUnitIncrement(int unitIncrement)
          Sets the unit increment for this scrollbar.
 void setValue(int value)
          Sets the value of this scrollbar to the specified value.
 void setValues(int value, int visibleAmount, int minimum, int maximum)
          Sets the values for this scrollbar.
 void setVisibleAmount(int visibleAmount)
          Sets the visible amount of this scrollbar, which is the range of values represented by the width of the scroll bar's bubble.
 void timerFired(TimerEvent event)
          The timer fired.
 void update(java.awt.Graphics g)
          Updates the graphics context for this scrollbar.
 
Methods inherited from class dog.gui.DComponent
addPropertyChangeListener, alignParamString, drawActiveButtonBorder, drawActiveOptionBorder, drawArrow, drawBackgroundImage, drawBorder, drawButtonBorder, drawCheckbox, drawDarkBorder, drawDefaultButtonBorder, drawDisabledBorder, drawDisabledCheckbox, drawDisabledOption, drawExpander, drawFocusBorder, drawImage, drawLabel, drawOption, drawOptionBorder, drawPressedBorder, drawTick, getDefaultToolkit, getImage, getImage, getImage, getRootPane, getRows, getTooltip, isPreloadImages, parseColor, parseFont, processCancelAction, processDefaultAction, removePropertyChangeListener, setEnabled, setPreloadImages, setTooltip, toString
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addNotify, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getAccessibleContext, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getName, getParent, getPeer, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFont, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, transferFocus, 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
The horizontal scrollbar variable.

VERTICAL

public static final int VERTICAL
The vertical scrollbar variable.

PREFERREDWIDTH

protected static int PREFERREDWIDTH
The preferred width for scrollbars.

value

protected int value
The value of the scrollbar.

maximum

protected int maximum
The maximum value of the scrollbar.

minimum

protected int minimum
The minimum value of the scrollbar.

visibleAmount

protected int visibleAmount
The size of the visible portion of the scrollbar.

orientation

protected int orientation
The scrollbar's orientation, either horizontal or vertical.

unitIncrement

protected int unitIncrement
The amount by which the scrollbar value will change when the user clicks one of the up or down buttons.

blockIncrement

protected int blockIncrement
The amount by which the scrollbar value will change when the user clicks above or below the block indicator.

dimpled

protected boolean dimpled
Whether to draw a NeXT-like dimple on the scrollbar.

reference

protected java.lang.Object reference
The object reference.

adjustmentListener

protected transient java.awt.event.AdjustmentListener adjustmentListener
Constructor Detail

DScrollbar

public DScrollbar()
Constructs a new vertical scrollbar.

DScrollbar

public DScrollbar(int orientation)
Constructs a new scrollbar with the specified orientation.
Parameters:
orientation - either DScrollbar.HORIZONTAL or DScrollbar.VERTICAL
Throws:
java.lang.IllegalArgumentException - When an illegal scrollbar orientation is given.

DScrollbar

public DScrollbar(int orientation,
                  int value,
                  int visibleAmount,
                  int minimum,
                  int maximum)
Constructs a new scrollbar with the specified orientation, value, page size, and minumum and maximum values.
Parameters:
orientation - either DScrollbar.HORIZONTAL or DScrollbar.VERTICAL
value - the scrollbar's value
visible - the size of the visible portion of the scrollable area. The scrollbar will use this value when paging up or down by a page.
minimum - the minimum value of the scrollbar
maximum - the maximum value of the scrollbar
Method Detail

getOrientation

public int getOrientation()
Returns the orientation for this scrollbar.
Specified by:
getOrientation in interface java.awt.Adjustable

setOrientation

public void setOrientation(int orientation)
Sets the orientation for this scrollbar.
Parameters:
orientation - the orientation (HORIZONTAL or VERTICAL) of this scrollbar.

getValue

public int getValue()
Returns the current value of this scrollbar.
Specified by:
getValue in interface java.awt.Adjustable
See Also:
getMinimum(), getMaximum()

setValue

public void setValue(int value)
Sets the value of this scrollbar to the specified value.
Specified by:
setValue in interface java.awt.Adjustable
Parameters:
value - the new value of the scrollbar. If this value is below the current minimum or above the current maximum minus the visible amount, it becomes the new one of those values, respectively.
See Also:
getValue()

getMinimum

public int getMinimum()
Returns the minimum value of this scrollbar.
Specified by:
getMinimum in interface java.awt.Adjustable
See Also:
getMaximum(), getValue()

setMinimum

public void setMinimum(int minimum)
Sets the minimum value for this scrollbar.
Specified by:
setMinimum in interface java.awt.Adjustable
Parameters:
minimum - the minimum value of the scrollbar

getMaximum

public int getMaximum()
Returns the maximum value of this scrollbar.
Specified by:
getMaximum in interface java.awt.Adjustable
See Also:
getMinimum(), getValue()

setMaximum

public void setMaximum(int maximum)
Sets the maximum value for this scrollbar.
Specified by:
setMaximum in interface java.awt.Adjustable
Parameters:
maximum - the maximum value of the scrollbar

getVisibleAmount

public int getVisibleAmount()
Returns the visible amount of this scrollbar.
Specified by:
getVisibleAmount in interface java.awt.Adjustable

setVisibleAmount

public void setVisibleAmount(int visibleAmount)
Sets the visible amount of this scrollbar, which is the range of values represented by the width of the scroll bar's bubble.
Specified by:
setVisibleAmount in interface java.awt.Adjustable
Parameters:
visible - the amount visible per page

setUnitIncrement

public void setUnitIncrement(int unitIncrement)
Sets the unit increment for this scrollbar. This is the value that will be added (subtracted) when the user hits the unit down (up) gadgets.
Specified by:
setUnitIncrement in interface java.awt.Adjustable

getUnitIncrement

public int getUnitIncrement()
Gets the unit increment for this scrollbar.
Specified by:
getUnitIncrement in interface java.awt.Adjustable

setBlockIncrement

public void setBlockIncrement(int blockIncrement)
Sets the block increment for this scrollbar. This is the value that will be added (subtracted) when the user hits the block down (up) gadgets.
Specified by:
setBlockIncrement in interface java.awt.Adjustable

getBlockIncrement

public int getBlockIncrement()
Gets the block increment for this scrollbar.
Specified by:
getBlockIncrement in interface java.awt.Adjustable

setParameters

public void setParameters(int minimum,
                          int maximum,
                          int visibleAmount,
                          int unitIncrement,
                          int blockIncrement)
Sets the parameters for this scrollbar. This method enforces the following constraints: Values which do not meet these criteria are quietly coerced to the appropriate boundary value.
Parameters:
minimum - is the minimum value of the scrollbar
maximum - is the maximum value of the scrollbar
unitIncrement - is the unit increment of the scrollbar
blockIncrement - is the block increment of the scrollbar

setValues

public void setValues(int value,
                      int visibleAmount,
                      int minimum,
                      int maximum)
Sets the values for this scrollbar. This method enforces the following constraints: Values which do not meet these criteria are quietly coerced to the appropriate boundary value.
Parameters:
value - is the position in the current window.
visibleAmount - is the amount visible per page
minimum - is the minimum value of the scrollbar
maximum - is the maximum value of the scrollbar

isDimpled

public boolean isDimpled()
Indicates whether to draw a dimple on the scrollbar.

setDimpled

public void setDimpled(boolean flag)
Sets whether to draw a dimple on the scrollbar.
Parameters:
flag - true if the dimple is to be drawn

getReference

public java.lang.Object getReference()
Returns the object reference.
Overrides:
getReference in class DComponent

setReference

public void setReference(java.lang.Object reference)
Sets the object reference.
Overrides:
setReference in class DComponent
Parameters:
reference - the object reference to store.

getPreferredSize

public java.awt.Dimension getPreferredSize()
Returns the preferred size of a scrollbar.
Overrides:
getPreferredSize in class java.awt.Component

isDragging

public boolean isDragging()
Indicates whether this scrollbar's value is being dragged by the user.

update

public void update(java.awt.Graphics g)
Updates the graphics context for this scrollbar.
Overrides:
update in class java.awt.Component

paint

public void paint(java.awt.Graphics g)
Paints this scrollbar.
Overrides:
paint in class java.awt.Component

addAdjustmentListener

public void addAdjustmentListener(java.awt.event.AdjustmentListener listener)
Adds the specified adjustment listener to receive adjustment events from this scrollbar.
Specified by:
addAdjustmentListener in interface java.awt.Adjustable
Parameters:
listener - the adjustment listener

removeAdjustmentListener

public void removeAdjustmentListener(java.awt.event.AdjustmentListener listener)
Removes the specified adjustment listener so that it no longer receives adjustment events from this scrollbar.
Specified by:
removeAdjustmentListener in interface java.awt.Adjustable
Parameters:
listener - the adjustment listener

processEvent

protected void processEvent(java.awt.AWTEvent event)
Processes events on this scrollbar. If the event is an AdjustmentEvent, it invokes the processAdjustmentEvent method.
Overrides:
processEvent in class DComponent
Parameters:
event - the event

processAdjustmentEvent

protected void processAdjustmentEvent(java.awt.event.AdjustmentEvent event)
Processes adjustment events on this scrollbar by dispatching them to any registered AdjustmentListener objects.
Parameters:
event - the adjustment event

processMouseEvent

protected void processMouseEvent(java.awt.event.MouseEvent event)
Processes mouse events on this scrollbar by dispatching them to any registered MouseListener objects.
Overrides:
processMouseEvent in class DComponent
Parameters:
event - the mouse event

processMouseMotionEvent

protected void processMouseMotionEvent(java.awt.event.MouseEvent event)
Processes mouse motion events on this scrollbar by dispatching them to any registered MouseMotionListener objects.
Overrides:
processMouseMotionEvent in class DComponent
Parameters:
event - the mouse motion event

timerFired

public void timerFired(TimerEvent event)
The timer fired.
Specified by:
timerFired in interface TimerListener

paramString

protected java.lang.String paramString()
Returns the String parameters for this scrollbar.
Overrides:
paramString in class DComponent