All Packages Class Hierarchy This Package Previous Next Index
Class tea.set.Slider
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Canvas
|
+----tea.set.Slider
- public class Slider
- extends Canvas
- implements Adjustable
Slider supports adjusting of values in a predefined range. It features
a slider, which can be dragged by an user to set the value of the
slider. A slider can be either horizontal or vertical. If it's
horizontal, the left end of the slider represents the lower value
of the range. If it's vertical, the right end of a slider represents
the higher value of the range. Adjustment events are generated
for value changes.
Slider supports the following properties:
Property Name | Property Type | Description |
Orientation | int |
Orientation flag, Adjustable.VERTICAL or Adjustable.HORIZONTAL. |
Style | int |
Style flag, Slider.SLIDE_BAR or Slider.SCALE_BAR. |
Minimum | int |
Minimum value of the slider. |
Maximum | int |
Maximum value of the slider. |
UnitIncrement | int |
Unit increment value of the slider. |
BlockIncrement | int |
Block increment value of the slider. The default block increment
is one tenth of the total range. |
VisibleAmout | int |
Not used. |
Value | int |
Current slider value. |
Slider generates the following events:
Event Type | Event ID | Generated |
Type | Description |
AdjustmentEvent | ActionEvent.ADJUSTMENT_VALUE_CHANGED |
UNIT_INCREMENT |
Mouse click on top/right box. |
AdjustmentEvent.getValue() is the slider value. |
AdjustmentEvent | ActionEvent.ADJUSTMENT_VALUE_CHANGED |
UNIT_DECREMENT |
Mouse click on left/bottom box. |
AdjustmentEvent.getValue() is the slider value. |
AdjustmentEvent | ActionEvent.ADJUSTMENT_VALUE_CHANGED |
BLOCK_INCREMENT |
Mouse click on top/right of slider bar. |
AdjustmentEvent.getValue() is the slider value. |
AdjustmentEvent | ActionEvent.ADJUSTMENT_VALUE_CHANGED |
BLOCK_DECREMENT |
Mouse click on below/left of slider bar. |
AdjustmentEvent.getValue() is the slider value. |
AdjustmentEvent | ActionEvent.ADJUSTMENT_VALUE_CHANGED |
TRACK |
Slider bar dragged. |
AdjustmentEvent.getValue() is the slider value. |
-
eventMgr
- EventMgr object handles added event processing and dispatching.
-
SCALE_BAR
- A scaling bar on top of a slider track.
-
SLIDE_BAR
- A sliding bar inside a slider track.
-
Slider()
- Construct a default Slider with the range set to 0-100 and
orientation to HORIZONTAL.
-
Slider(int, int, int)
- Construct a Slider with the specified range and orientation.
-
addAdjustmentListener(AdjustmentListener)
- Add a listener to recieve adjustment events when the value of
the Slider changes.
-
doLayout()
- Calculate layout parameters for the slider.
-
getBlockIncrement()
- Gets the block value increment for the Slider.
-
getMaximum()
- Gets the maximum value of the adjustable object.
-
getMinimum()
- Gets the minimum value of the adjustable object.
-
getMinimumSize()
- Get the minimum size of the slider.
-
getOrientation()
- Gets the orientation of the adjustable object.
-
getPreferredSize()
- Get the preferred size of the slider.
-
getStyle()
- Get the current slider style.
-
getUnitIncrement()
- Gets the unit value increment for the adjustable object.
-
getValue()
- Get the current slider value.
-
getVisibleAmount()
- Gets the length of the propertional indicator.
-
paint(Graphics)
- Paint slider.
-
processAdjustmentEvent(AdjustmentEvent)
- Process and dispatch adjustment event.
-
processEvent(AWTEvent)
- Process and dispatch event.
-
processMouseEvent(MouseEvent)
- Mouse event handler.
-
processMouseMotionEvent(MouseEvent)
- Mouse motion event handler.
-
removeAdjustmentListener(AdjustmentListener)
- Removes an adjustment listener.
-
setBlockIncrement(int)
- Sets the block value increment for the Slider.
-
setMaximum(int)
- Sets the maximum value of the adjustable object.
-
setMinimum(int)
- Sets the minimum value of the adjustable object.
-
setStyle(int)
- Change the style of the slider.
-
setUnitIncrement(int)
- Sets the unit value increment for the adjustable object.
-
setValue(int)
- Set the value of the slider.
-
setVisibleAmount(int)
- Sets the length of the proportionl indicator of the
Slider.
-
update(Graphics)
- Overriden for double buffering.
SLIDE_BAR
public static final int SLIDE_BAR
- A sliding bar inside a slider track.
SCALE_BAR
public static final int SCALE_BAR
- A scaling bar on top of a slider track.
eventMgr
protected EventMgr eventMgr
- EventMgr object handles added event processing and dispatching.
Slider
public Slider()
- Construct a default Slider with the range set to 0-100 and
orientation to HORIZONTAL.
Slider
public Slider(int low,
int high,
int orientation)
- Construct a Slider with the specified range and orientation.
- Parameters:
- low - lower value of the range.
- high - higher value of the range.
- orientation - orientation flag, Adjustable.VERTICAL or
Adjustable.HORIZONTAL.
getOrientation
public int getOrientation()
- Gets the orientation of the adjustable object.
- Returns:
- orientation.
setStyle
public synchronized void setStyle(int style)
- Change the style of the slider.
- Parameters:
- style - style flag.
getStyle
public int getStyle()
- Get the current slider style.
- Returns:
- style flag.
setMinimum
public void setMinimum(int min)
- Sets the minimum value of the adjustable object.
- Parameters:
- min - the minimum value
getMinimum
public int getMinimum()
- Gets the minimum value of the adjustable object.
setMaximum
public void setMaximum(int max)
- Sets the maximum value of the adjustable object.
- Parameters:
- max - the maximum value
getMaximum
public int getMaximum()
- Gets the maximum value of the adjustable object.
setUnitIncrement
public void setUnitIncrement(int u)
- Sets the unit value increment for the adjustable object.
- Parameters:
- u - the unit increment
getUnitIncrement
public int getUnitIncrement()
- Gets the unit value increment for the adjustable object.
setBlockIncrement
public void setBlockIncrement(int b)
- Sets the block value increment for the Slider.
- Parameters:
- b - the block increment
getBlockIncrement
public int getBlockIncrement()
- Gets the block value increment for the Slider.
setVisibleAmount
public void setVisibleAmount(int v)
- Sets the length of the proportionl indicator of the
Slider.
- Parameters:
- v - the length of the indicator
getVisibleAmount
public int getVisibleAmount()
- Gets the length of the propertional indicator.
addAdjustmentListener
public void addAdjustmentListener(AdjustmentListener l)
- Add a listener to recieve adjustment events when the value of
the Slider changes.
- Parameters:
- l - the listener to recieve events
- See Also:
- AdjustmentEvent
removeAdjustmentListener
public void removeAdjustmentListener(AdjustmentListener l)
- Removes an adjustment listener.
- Parameters:
- l - the listener being removed
- See Also:
- AdjustmentEvent
processAdjustmentEvent
public void processAdjustmentEvent(AdjustmentEvent e)
- Process and dispatch adjustment event.
- Parameters:
- e - adjustment event.
processEvent
public void processEvent(AWTEvent e)
- Process and dispatch event.
- Parameters:
- e - event object.
- Overrides:
- processEvent in class Component
setValue
public void setValue(int v)
- Set the value of the slider.
- Parameters:
- v - slider value.
getValue
public int getValue()
- Get the current slider value.
- Returns:
- slider value.
getPreferredSize
public Dimension getPreferredSize()
- Get the preferred size of the slider.
- Returns:
- preferred size of the slider.
- Overrides:
- getPreferredSize in class Component
getMinimumSize
public Dimension getMinimumSize()
- Get the minimum size of the slider.
- Returns:
- minimum size of the slider.
- Overrides:
- getMinimumSize in class Component
paint
public void paint(Graphics g)
- Paint slider.
- Overrides:
- paint in class Canvas
update
public void update(Graphics g)
- Overriden for double buffering.
- Overrides:
- update in class Component
doLayout
public void doLayout()
- Calculate layout parameters for the slider.
- Overrides:
- doLayout in class Component
processMouseEvent
public void processMouseEvent(MouseEvent e)
- Mouse event handler.
- Overrides:
- processMouseEvent in class Component
processMouseMotionEvent
public void processMouseMotionEvent(MouseEvent e)
- Mouse motion event handler.
- Overrides:
- processMouseMotionEvent in class Component
All Packages Class Hierarchy This Package Previous Next Index