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.

Variable Index

 o ABSOLUTE
Display the absolute value.
 o HORIZONTAL
Meter grows from left to right.
 o NONE
Don't display value.
 o PERCENT
Display the current value as a percentage of the range.
 o VERTICAL
Meter grows from bottom up.

Constructor Index

 o Meter(int, int)
Construct a meter with specified range.
 o Meter(int, int, int)
Construct a meter with specified range.

Method Index

 o getHigh()
Return the higher value of the range.
 o getLow()
Return the lower value of the range.
 o getValue()
Return the current value of the meter.
 o minimumSize()
Return the minimum size of the meter.
 o paint(Graphics)
Paint meter.
 o preferredSize()
Return the preferred size of the meter.
 o setColor(Color)
Set the filling color.
 o setDisplay(int)
Set the display style.
 o setValue(int)
Set the current value of the meter.
 o update(Graphics)
Overriden for double buffering.

Variables

 o NONE
  public final static int NONE
Don't display value.
 o PERCENT
  public final static int PERCENT
Display the current value as a percentage of the range.
 o ABSOLUTE
  public final static int ABSOLUTE
Display the absolute value.
 o HORIZONTAL
  public final static int HORIZONTAL
Meter grows from left to right.
 o VERTICAL
  public final static int VERTICAL
Meter grows from bottom up.

Constructors

 o 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.
 o 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.

Methods

 o setValue
  public void setValue(int value)
Set the current value of the meter. This causes a repaint.
Parameters:
value - current value.
 o getValue
  public int getValue()
Return the current value of the meter.
Returns:
current value.
 o getLow
  public int getLow()
Return the lower value of the range.
Returns:
lower bound.
 o getHigh
  public int getHigh()
Return the higher value of the range.
Returns:
higher bound.
 o setDisplay
  public void setDisplay(int dispF)
Set the display style. It can either be NONE, PERCENT, or ABSOLUTE.
Parameters:
dispf - label display option.
 o setColor
  public void setColor(Color c)
Set the filling color. The default color is blue.
Parameters:
c - filling color.
 o preferredSize
  public Dimension preferredSize()
Return the preferred size of the meter.
Returns:
preferred size.
Overrides:
preferredSize in class Component
 o minimumSize
  public Dimension minimumSize()
Return the minimum size of the meter.
Returns:
minimum size.
Overrides:
minimumSize in class Component
 o paint
  public void paint(Graphics g)
Paint meter.
Parameters:
g - Graphics context of this component.
Overrides:
paint in class Canvas
 o 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