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.
Meter supports the following properties:
Property Name | Property Type | Description |
Value | int |
Current meter value. |
Low | int |
The lower end of the range. |
High | int |
The higher end of the range. |
Display | int |
Label display flag. |
Color | Color |
Meter fill color. |
-
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 (Default).
-
VERTICAL
- Meter grows from bottom up.
-
Meter()
- Construct a default Meter, and set the range to 0-100.
-
Meter(int, int)
- Construct a meter with specified range.
-
Meter(int, int, int)
- Construct a meter with specified range.
-
getColor()
- Get the filling color.
-
getDisplay()
- Get display option, NONE, PERCENT, or ABSOLUTE.
-
getHigh()
- Return the higher value of the range.
-
getLow()
- Return the lower value of the range.
-
getMinimumSize()
- Return the minimum size of the meter.
-
getPreferredSize()
- Return the preferred size of the meter.
-
getValue()
- Return the current value of the meter.
-
paint(Graphics)
- Paint 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 static final int NONE
- Don't display value.
PERCENT
public static final int PERCENT
- Display the current value as a percentage of the range (Default).
ABSOLUTE
public static final int ABSOLUTE
- Display the absolute value.
HORIZONTAL
public static final int HORIZONTAL
- Meter grows from left to right.
VERTICAL
public static final int VERTICAL
- Meter grows from bottom up.
Meter
public Meter()
- Construct a default Meter, and set the range to 0-100.
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 synchronized 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.
getDisplay
public int getDisplay()
- Get display option, NONE, PERCENT, or ABSOLUTE.
- Returns:
- display option.
setColor
public void setColor(Color c)
- Set the filling color. The default color is blue.
- Parameters:
- c - filling color.
getColor
public Color getColor()
- Get the filling color.
- Returns:
- filling color.
getPreferredSize
public Dimension getPreferredSize()
- Return the preferred size of the meter.
- Returns:
- preferred size.
- Overrides:
- getPreferredSize in class Component
getMinimumSize
public Dimension getMinimumSize()
- Return the minimum size of the meter.
- Returns:
- minimum size.
- Overrides:
- getMinimumSize 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