All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class COM.taligent.widget.Scroller

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Canvas
                   |
                   +----COM.taligent.widget.Scroller

public class Scroller
extends Canvas
implements Adjustable, Runnable, KeyListener, MouseListener, MouseMotionListener
A custom JDK 1.1 scrollbar. The Scroller class behaves exactly like AWT scrollbars.

You can change the appearance of the scrollbar by extending Scroller and overriding paintBackground, paintButton, and paintHandle.


Variable Index

 o DEFAULT_ORIENTATION
Default orientation (VERTICAL).
 o DEFAULT_SCROLL_DELAY
Default scroll delay between successive scrolls (125 ms).
 o DOWN
The "down" button (internal use only).
 o HORIZONTAL
Horizontal orientation.
 o LEFT
The "left" button (internal use only).
 o RIGHT
The "right" button (internal use only).
 o serialVersionUID
 o UP
The "up" button (internal use only).
 o VERTICAL
Vertical orientation.

Constructor Index

 o Scroller()
Constructs a scrollbar with the default orientation.
 o Scroller(int)
Constructs a scrollbar with the specified orientation.
 o Scroller(int, int, int, int, int)
Constructs scrollbar with specified values.

Method Index

 o addAdjustmentListener(AdjustmentListener)
Adds an item listener.
 o getBlockIncrement()
Returns the current block increment value.
 o getLineIncrement()
Returns current unit increment. Deprecated.
 o getMaximum()
Returns the current maximum value of this scrollbar.
 o getMinimum()
Returns the current minimum value of this scrollbar.
 o getMinimumSize()
Returns an arbitrary minimum size of the scrollbar.
 o getName()
Returns the current name of this scrollbar instance.
 o getOrientation()
Returns the current orientation of this scrollbar.
 o getPageIncrement()
Returns the current block increment. Deprecated.
 o getPreferredSize()
Returns the preferred size (minimum size) of the component.
 o getScrollDelay()
Returns the current scroll delay.
 o getUnitIncrement()
Returns the current unit increment value.
 o getValue()
Returns the current value of this scrollbar.
 o getVisibleAmount()
Returns how many elements are currently visible.
 o init()
Initialize transient data.
 o keyPressed(KeyEvent)
Key pressed.
 o keyReleased(KeyEvent)
Key released.
 o keyTyped(KeyEvent)
Key typed.
 o minimumSize()
The method minimumSize doesn't call getMinimumSize like it should. Deprecated.
 o mouseClicked(MouseEvent)
Mouse clicked.
 o mouseDragged(MouseEvent)
Mouse dragged.
 o mouseEntered(MouseEvent)
Mouse entered component.
 o mouseExited(MouseEvent)
Mouse exited component.
 o mouseMoved(MouseEvent)
Mouse moved.
 o mousePressed(MouseEvent)
Mouse pressed.
 o mouseReleased(MouseEvent)
Mouse released.
 o paint(Graphics)
Paint the scrollbar with the current settings.
 o paintBackground(Graphics)
Paints the background of the scrollbar.
 o paintButton(Graphics, int)
Paints a button.
 o paintHandle(Graphics)
Paints the handle.
 o preferredSize()
The method preferredSize doesn't call getPreferredSize like it should. Deprecated.
 o removeAdjustmentListener(AdjustmentListener)
Removes an item listener.
 o run()
Allows continuation of scrolling when mouse button stays down on scrolls.
 o setBackground(Color)
Invalidate background buffer if color changed.
 o setBlockIncrement(int)
Sets how many to increment/decrement by when the user presses in the scrollbar region between the unit increment buttons and the scroll handle.
 o setForeground(Color)
Invalidate background buffer if color changed.
 o setLineIncrement(int)
Sets how many units to increment/decrement by when the user pushes the up/down (or left/right) scroll buttons. Deprecated.
 o setMaximum(int)
Sets the maximum value of this scrollbar.
 o setMinimum(int)
Sets the minimum value of this scrollbar.
 o setName(String)
Sets the name for this scrollbar instance.
 o setOrientation(int)
Sets the orientation of the scrollbar.
 o setPageIncrement(int)
Sets how many to increment/decrement by when the user presses in the scrollbar region between the unit increment buttons and the scroll handle. Deprecated.
 o setScrollDelay(int)
Sets the delay between successive scrolls.
 o setSize(Dimension)
Sets the size making sure that the scrollbar isn't set too wide.
 o setSize(int, int)
Sets the size making sure that the scrollbar isn't set too wide.
 o setUnitIncrement(int)
Sets how many units to increment/decrement by when the user pushes the up/down (or left/right) scroll buttons.
 o setValue(int)
Sets the value of this scrollbar.
 o setValues(int, int, int, int)
Sets all of the values of this scrollbar.
 o setVisibleAmount(int)
Sets how many elements are currently visible.
 o toString()
Returns a string representation of this component.
 o update(Graphics)
Don't clear area -- not needed.

Variables

 o serialVersionUID
 public static final long serialVersionUID
 o VERTICAL
 public static final int VERTICAL
Vertical orientation.

 o HORIZONTAL
 public static final int HORIZONTAL
Horizontal orientation.

 o DEFAULT_ORIENTATION
 public static final int DEFAULT_ORIENTATION
Default orientation (VERTICAL).

 o DEFAULT_SCROLL_DELAY
 public static final int DEFAULT_SCROLL_DELAY
Default scroll delay between successive scrolls (125 ms).

 o UP
 protected static final int UP
The "up" button (internal use only).

 o DOWN
 protected static final int DOWN
The "down" button (internal use only).

 o LEFT
 protected static final int LEFT
The "left" button (internal use only).

 o RIGHT
 protected static final int RIGHT
The "right" button (internal use only).

Constructors

 o Scroller
 public Scroller()
Constructs a scrollbar with the default orientation.

 o Scroller
 public Scroller(int orientation)
Constructs a scrollbar with the specified orientation.

 o Scroller
 public Scroller(int orientation,
                 int value,
                 int visible,
                 int min,
                 int max)
Constructs scrollbar with specified values.

Methods

 o init
 public void init()
Initialize transient data.

 o setBackground
 public void setBackground(Color color)
Invalidate background buffer if color changed.

Overrides:
setBackground in class Component
 o setForeground
 public void setForeground(Color color)
Invalidate background buffer if color changed.

Overrides:
setForeground in class Component
 o setName
 public void setName(String name)
Sets the name for this scrollbar instance.

Parameters:
name - The new name.
Overrides:
setName in class Component
See Also:
getName
 o getName
 public String getName()
Returns the current name of this scrollbar instance.

Overrides:
getName in class Component
 o run
 public void run()
Allows continuation of scrolling when mouse button stays down on scrolls.

 o setScrollDelay
 public void setScrollDelay(int delay)
Sets the delay between successive scrolls.

Parameters:
delay - The new delay time, in milliseconds.
See Also:
DEFAULT_SCROLL_DELAY, getScrollDelay
 o getScrollDelay
 public int getScrollDelay()
Returns the current scroll delay.

See Also:
setScrollDelay
 o addAdjustmentListener
 public void addAdjustmentListener(AdjustmentListener listener)
Adds an item listener.

 o removeAdjustmentListener
 public void removeAdjustmentListener(AdjustmentListener listener)
Removes an item listener.

 o setOrientation
 public void setOrientation(int orientation)
Sets the orientation of the scrollbar.

Parameters:
orientation - The new orientation An invalid orientation is considered to be HORIZONTAL.
See Also:
VERTICAL, HORIZONTAL, getOrientation
 o getOrientation
 public int getOrientation()
Returns the current orientation of this scrollbar.

See Also:
setOrientation
 o setValue
 public void setValue(int value)
Sets the value of this scrollbar.

Parameters:
value - The new value. The new value is adjusted automatically if the value is less than or greater than the minimum and maximum values, respectively.
See Also:
setValues, getValue
 o getValue
 public int getValue()
Returns the current value of this scrollbar.

See Also:
setValue
 o setValues
 public void setValues(int value,
                       int visible,
                       int min,
                       int max)
Sets all of the values of this scrollbar. The values are set in the following order: min, max, value, and visible. This is so that the value can be checked against the new minimum and maximum values.

Parameters:
value - The new value.
visible - The visible value.
min - The minimum value of the scrollbar.
max - The maximum value of the scrollbar.
See Also:
setValue, getValue
 o setMinimum
 public void setMinimum(int minimum)
Sets the minimum value of this scrollbar.

Parameters:
minimum - The new minimum value. The minimum value is automatically adjusted if the new value is greater than the scrollbar's maximum value.
See Also:
setMaximum, getMinimum
 o getMinimum
 public int getMinimum()
Returns the current minimum value of this scrollbar.

See Also:
setMinimum
 o setMaximum
 public void setMaximum(int maximum)
Sets the maximum value of this scrollbar.

Parameters:
maximum - The new maximum value. The maximum value is automatically adjusted if the new value is less than the scrollbar's minimum value.
See Also:
setMinimum, getMaximum
 o getMaximum
 public int getMaximum()
Returns the current maximum value of this scrollbar.

See Also:
setMaximum
 o setLineIncrement
 public void setLineIncrement(int increment)
Note: setLineIncrement() is deprecated. Use setUnitIncrement(int).

Sets how many units to increment/decrement by when the user pushes the up/down (or left/right) scroll buttons.

 o getLineIncrement
 public int getLineIncrement()
Note: getLineIncrement() is deprecated. Use getUnitIncrement().

Returns current unit increment.

 o setUnitIncrement
 public void setUnitIncrement(int increment)
Sets how many units to increment/decrement by when the user pushes the up/down (or left/right) scroll buttons.

Parameters:
increment - The new unit increment value. No error checking is done on the increment. In other words, you could have the scrollbar move down when they hit the up button by settings the increment to a negative value.
See Also:
getUnitIncrement, setBlockIncrement
 o getUnitIncrement
 public int getUnitIncrement()
Returns the current unit increment value.

See Also:
setUnitIncrement
 o setPageIncrement
 public void setPageIncrement(int increment)
Note: setPageIncrement() is deprecated. Use setBlockIncrement(int).

Sets how many to increment/decrement by when the user presses in the scrollbar region between the unit increment buttons and the scroll handle.

 o getPageIncrement
 public int getPageIncrement()
Note: getPageIncrement() is deprecated. Use getBlockIncrement().

Returns the current block increment.

 o setBlockIncrement
 public void setBlockIncrement(int increment)
Sets how many to increment/decrement by when the user presses in the scrollbar region between the unit increment buttons and the scroll handle.

Parameters:
increment - The new block increment value.
See Also:
getBlockIncrement, setUnitIncrement
 o getBlockIncrement
 public int getBlockIncrement()
Returns the current block increment value.

See Also:
setBlockIncrement
 o setVisibleAmount
 public void setVisibleAmount(int visible)
Sets how many elements are currently visible.

Parameters:
visible - Number of visible elements.
See Also:
getVisibleAmount
 o getVisibleAmount
 public int getVisibleAmount()
Returns how many elements are currently visible.

See Also:
setVisibleAmount
 o preferredSize
 public Dimension preferredSize()
Note: preferredSize() is deprecated. Use getPreferredSize().

The method preferredSize doesn't call getPreferredSize like it should. Once preferredSize is fully deprecated, this will go away.

Overrides:
preferredSize in class Component
 o getPreferredSize
 public Dimension getPreferredSize()
Returns the preferred size (minimum size) of the component.

Overrides:
getPreferredSize in class Component
 o minimumSize
 public Dimension minimumSize()
Note: minimumSize() is deprecated. Use getMinimumSize().

The method minimumSize doesn't call getMinimumSize like it should. Once mimimumSize is fully deprecated, this will go away.

Overrides:
minimumSize in class Component
 o getMinimumSize
 public Dimension getMinimumSize()
Returns an arbitrary minimum size of the scrollbar.

Overrides:
getMinimumSize in class Component
 o setSize
 public void setSize(Dimension size)
Sets the size making sure that the scrollbar isn't set too wide.

Parameters:
size - The new size of the scrollbar.
Overrides:
setSize in class Component
 o setSize
 public void setSize(int width,
                     int height)
Sets the size making sure that the scrollbar isn't set too wide.

Parameters:
width - The new width.
height - The new height.
Overrides:
setSize in class Component
 o update
 public void update(Graphics g)
Don't clear area -- not needed.

Overrides:
update in class Component
 o paint
 public void paint(Graphics graphics)
Paint the scrollbar with the current settings.

Parameters:
g - The graphics context.
Overrides:
paint in class Canvas
 o paintBackground
 public void paintBackground(Graphics graphics)
Paints the background of the scrollbar. This is the area used between the scroll buttons and the handle. You can override this method to alter the appearance of the scrollbar.

Parameters:
g - The graphics context.
See Also:
paintButton, paintHandle
 o paintButton
 public void paintButton(Graphics g,
                         int type)
Paints a button. This method can be overridden to alter the appearance of the scrollbar.

Parameters:
g - The graphics context.
type - Which button to draw.
See Also:
UP, DOWN, LEFT, RIGHT, paintBackground, paintHandle
 o paintHandle
 public void paintHandle(Graphics g)
Paints the handle. This method can be overridden to alter the appearance of the scrollbar.

Parameters:
g - The graphics context.
See Also:
paintBackground, paintButton
 o keyTyped
 public void keyTyped(KeyEvent evt)
Key typed.

 o keyPressed
 public void keyPressed(KeyEvent evt)
Key pressed.

 o keyReleased
 public void keyReleased(KeyEvent evt)
Key released.

 o mouseClicked
 public void mouseClicked(MouseEvent evt)
Mouse clicked.

 o mousePressed
 public void mousePressed(MouseEvent evt)
Mouse pressed.

 o mouseReleased
 public void mouseReleased(MouseEvent evt)
Mouse released.

 o mouseEntered
 public void mouseEntered(MouseEvent evt)
Mouse entered component.

 o mouseExited
 public void mouseExited(MouseEvent evt)
Mouse exited component.

 o mouseDragged
 public void mouseDragged(MouseEvent evt)
Mouse dragged.

 o mouseMoved
 public void mouseMoved(MouseEvent evt)
Mouse moved.

 o toString
 public String toString()
Returns a string representation of this component.

Overrides:
toString in class Component

All Packages  Class Hierarchy  This Package  Previous  Next  Index