Class tea.set.Meter
All Packages Class Hierarchy This Package Previous Next Index
Class tea.set.Meter
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Canvas
|
+----tea.set.Meter
- public class Meter
- extends Canvas
Meter widget is a simple widget used to show a progress of a value.
There are two layout for the meter. A meter can be horizontally
layed out, and it grows from left to right. Or it can be vertically
layed out, in which case it grows from bottom up. The value of
the meter can be displayed as either percentage of the range, or
as an absolute value. The display of the value can also be disabled
by specifying NONE flag. Meter display draw a border around the
display area, use Effect3D to add a border if it's desired.
-
ABSOLUTE
- Display the absolute value.
-
HORIZONTAL
- Meter grows from left to right.
-
NONE
- Don't display value.
-
PERCENT
- Display the current value as a percentage of the range.
-
VERTICAL
- Meter grows from bottom up.
-
Meter(int, int)
- Construct a meter with specified range.
-
Meter(int, int, int)
- Construct a meter with specified range.
-
getHigh()
- Return the higher value of the range.
-
getLow()
- Return the lower value of the range.
-
getValue()
- Return the current value of the meter.
-
minimumSize()
- Return the minimum size of the meter.
-
paint(Graphics)
- Paint meter.
-
preferredSize()
- Return the preferred size of the meter.
-
setColor(Color)
- Set the filling color.
-
setDisplay(int)
- Set the display style.
-
setValue(int)
- Set the current value of the meter.
-
update(Graphics)
- Overriden for double buffering.
NONE
public final static int NONE
- Don't display value.
PERCENT
public final static int PERCENT
- Display the current value as a percentage of the range.
ABSOLUTE
public final static int ABSOLUTE
- Display the absolute value.
HORIZONTAL
public final static int HORIZONTAL
- Meter grows from left to right.
VERTICAL
public final static int VERTICAL
- Meter grows from bottom up.
Meter
public Meter(int low,
int high)
- Construct a meter with specified range. The direction defaults
to HORIZONTAL.
- Parameters:
- low - range lower bound.
- high - range higher bound.
Meter
public Meter(int low,
int high,
int direction)
- Construct a meter with specified range. The direction parameter
can either be HORIZONTAL or VERTICAL.
- Parameters:
- low - range lower bound.
- high - range higher bound.
- direction - can be either HORIZONTAL or VERTICAL.
setValue
public void setValue(int value)
- Set the current value of the meter. This causes a repaint.
- Parameters:
- value - current value.
getValue
public int getValue()
- Return the current value of the meter.
- Returns:
- current value.
getLow
public int getLow()
- Return the lower value of the range.
- Returns:
- lower bound.
getHigh
public int getHigh()
- Return the higher value of the range.
- Returns:
- higher bound.
setDisplay
public void setDisplay(int dispF)
- Set the display style. It can either be NONE, PERCENT, or
ABSOLUTE.
- Parameters:
- dispf - label display option.
setColor
public void setColor(Color c)
- Set the filling color. The default color is blue.
- Parameters:
- c - filling color.
preferredSize
public Dimension preferredSize()
- Return the preferred size of the meter.
- Returns:
- preferred size.
- Overrides:
- preferredSize in class Component
minimumSize
public Dimension minimumSize()
- Return the minimum size of the meter.
- Returns:
- minimum size.
- Overrides:
- minimumSize in class Component
paint
public void paint(Graphics g)
- Paint meter.
- Parameters:
- g - Graphics context of this component.
- Overrides:
- paint in class Canvas
update
public void update(Graphics g)
- Overriden for double buffering.
- Parameters:
- g - Graphics context of this component.
- Overrides:
- update in class Component
All Packages Class Hierarchy This Package Previous Next Index