All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class jclass.bwt.JCProgressMeter

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Canvas
                   |
                   +----jclass.bwt.JCComponent
                           |
                           +----jclass.bwt.JCProgressMeter

public class JCProgressMeter
extends JCComponent
A progress meter can be used by an application to indicate the progress of a lengthy operation. It consists of a rectangle that is gradually filled, from left to right, as an operation progresses. An optional label can be used to display the meter's current value or an application-defined string.

Properties

Name Method
AutoLabel setAutoLabel
Background setBackground
BarColor setBarColor
BarCount setBarCount
BarSpacing setBarSpacing
Font setFont
Foreground setForeground
Label setLabel
LabelPosition setLabelPosition
LabelWidth setLabelWidth
Maximum setMaximum
Minimum setMinimum
PreferredSize setPreferredSize
ShowLabel setShowLabel
Value setValue
UserData setUserData


Variable Index

 o bar_area
Bar area's bounding box
 o bar_height
Bar's height.
 o bar_horiz_inset
Bar's left and right inset.
 o bar_rect
Bar's drawn bounding box.
 o bar_shadow
Bar's shadow thickness.
 o bar_vert_inset
Bar's top and bottom inset.
 o label_inset
Space between label and bar area, if label is not centered.
 o STRING_BOTTOM
 o STRING_CENTER
 o STRING_LEFT
 o STRING_RIGHT
 o STRING_TOP

Constructor Index

 o JCProgressMeter()
Constructs a meter with a range of [0, 100].
 o JCProgressMeter(Applet, String)
Creates a meter which reads parameters from the applet's HTML file.
 o JCProgressMeter(int, int, int)
Constructs a meter with a value, and minimum and max values.

Method Index

 o drawBar(Graphics)
Draws the bar.
 o drawLabel(Graphics, String)
Draws the label.
 o drawShadow(Graphics)
Draws the shadow around the bar.
 o getAutoLabel()
Gets the AutoLabel value.
 o getBarColor()
Gets the BarColor value.
 o getBarCount()
Gets the BarCount value.
 o getBarSpacing()
Gets the BarSpacing value.
 o getLabel()
Gets the Label value.
 o getLabelPosition()
Gets the LabelPosition value.
 o getLabelWidth()
Gets the LabelWidth value.
 o getMaximum()
Gets the maximum value.
 o getMinimum()
Gets the minimum value.
 o getParameters()
Reads the parameter values from the HTML page using the component's applet.
 o getShowLabel()
Gets the ShowLabel value.
 o getTimeElapsed()
Gets the time elapsed (in ms) since the minimum value was last set.
 o getTimeToCompletion()
Calculates an estimate of the time (in ms) before which the value will be 100%.
 o getTimeToCompletionString()
Calculates an estimate of the time before which the value will be 100%.
 o getValue()
Gets the current value.
 o getValuePercentage()
Gets the current value as a percentage of the range.
 o layout()
Lays out the component's internal elements.
 o paintComponent(Graphics)
Draws the shadow, bar and label.
 o preferredHeight()
Gets the subclass' preferred height (default: 100).
 o preferredWidth()
Gets the subclass' preferred width (default: 100).
 o setAutoLabel(boolean)
If true (default), a label will be displayed showing the meter's value as a percentage.
 o setBarColor(Color)
Sets the bar's color (default: red).
 o setBarCount(int)
Sets the number of discrete bars eventually displayed (default: 10).
 o setBarSpacing(int)
Sets the space (in pixels) between each bar, if BarCount is greater than 1 (default: 2).
 o setLabel(String)
Sets the label (default: null).
 o setLabelPosition(int)
Sets the label's position, relative to the bar: STRING_TOP, STRING_LEFT, STRING_RIGHT (default), STRING_BOTTOM or STRING_CENTER
 o setLabelWidth(int)
Sets the maximum number of characters which will be displayed, if ShowLabel is true (default: 4 if AutoLabel is true, 10 otherwise).
 o setMaximum(int)
Sets the maximum value.
 o setMinimum(int)
Sets the minimum value.
 o setShowLabel(boolean)
If true (default), a label will be displayed.
 o setValue(int)
Sets the value.
 o setValues(int, int, int)
Sets the meter's values.

Variables

 o STRING_LEFT
  public final static int STRING_LEFT
 o STRING_RIGHT
  public final static int STRING_RIGHT
 o STRING_TOP
  public final static int STRING_TOP
 o STRING_BOTTOM
  public final static int STRING_BOTTOM
 o STRING_CENTER
  public final static int STRING_CENTER
 o label_inset
  protected int label_inset
Space between label and bar area, if label is not centered.

 o bar_area
  protected Rectangle bar_area
Bar area's bounding box

 o bar_rect
  protected Rectangle bar_rect
Bar's drawn bounding box.

 o bar_height
  protected int bar_height
Bar's height.

 o bar_vert_inset
  protected int bar_vert_inset
Bar's top and bottom inset.

 o bar_horiz_inset
  protected int bar_horiz_inset
Bar's left and right inset.

 o bar_shadow
  protected int bar_shadow
Bar's shadow thickness.

Constructors

 o JCProgressMeter
  public JCProgressMeter()
Constructs a meter with a range of [0, 100].

See Also:
setValues
 o JCProgressMeter
  public JCProgressMeter(Applet applet,
                         String name)
Creates a meter which reads parameters from the applet's HTML file.

Parameters:
applet - the applet whose PARAM tags are to be read
name - if this is not null, only parameters preceded by this name are read
See Also:
getParameter
 o JCProgressMeter
  public JCProgressMeter(int value,
                         int min,
                         int max)
Constructs a meter with a value, and minimum and max values.

Parameters:
value - the meter's value
min - the min value
max - the max value

Methods

 o getParameters
  protected void getParameters()
Reads the parameter values from the HTML page using the component's applet. The values will override those previously set.

Overrides:
getParameters in class JCComponent
 o getValue
  public int getValue()
Gets the current value.

 o getValuePercentage
  public int getValuePercentage()
Gets the current value as a percentage of the range.

 o setValue
  public synchronized void setValue(int v)
Sets the value.

Parameters:
value - the new value. If this value is below the current minimum or above the current maximum, it becomes the new one of those values, respectively.
See Also:
getValue
 o getMinimum
  public int getMinimum()
Gets the minimum value.

See Also:
setValues
 o setMinimum
  public void setMinimum(int v)
Sets the minimum value.

See Also:
setValues
 o getMaximum
  public int getMaximum()
Gets the maximum value.

See Also:
setValues
 o setMaximum
  public void setMaximum(int v)
Sets the maximum value.

See Also:
setValues
 o setValues
  public synchronized void setValues(int value,
                                     int min,
                                     int max)
Sets the meter's values.

Parameters:
value - the meter's value
min - the minimum value of the meter
max - the maximum value of the meter
 o getBarColor
  public Color getBarColor()
Gets the BarColor value.

See Also:
setBarColor
 o setBarColor
  public synchronized void setBarColor(Color v)
Sets the bar's color (default: red).

 o getBarCount
  public int getBarCount()
Gets the BarCount value.

See Also:
setBarCount
 o setBarCount
  public synchronized void setBarCount(int v)
Sets the number of discrete bars eventually displayed (default: 10).

 o getBarSpacing
  public int getBarSpacing()
Gets the BarSpacing value.

See Also:
setBarSpacing
 o setBarSpacing
  public synchronized void setBarSpacing(int v)
Sets the space (in pixels) between each bar, if BarCount is greater than 1 (default: 2).

See Also:
setBarCount
 o getLabel
  public String getLabel()
Gets the Label value.

See Also:
setLabel
 o setLabel
  public synchronized void setLabel(String s)
Sets the label (default: null). If set, this value overrides the AutoLabel value.

See Also:
setAutoLabel, setLabelPosition
 o getAutoLabel
  public boolean getAutoLabel()
Gets the AutoLabel value.

See Also:
setAutoLabel
 o setAutoLabel
  public synchronized void setAutoLabel(boolean v)
If true (default), a label will be displayed showing the meter's value as a percentage. If Label is not null, it will be displayed instead. If set to true and LabelWidth has not been set, its value is set to 4.

See Also:
setLabel, setLabelPosition, setLabelWidth
 o getShowLabel
  public boolean getShowLabel()
Gets the ShowLabel value.

See Also:
setShowLabel
 o setShowLabel
  public synchronized void setShowLabel(boolean v)
If true (default), a label will be displayed.

See Also:
setAutoLabel, setLabel, setLabelPosition
 o getLabelPosition
  public int getLabelPosition()
Gets the LabelPosition value.

See Also:
setLabelPosition
 o setLabelPosition
  public synchronized void setLabelPosition(int v)
Sets the label's position, relative to the bar: STRING_TOP, STRING_LEFT, STRING_RIGHT (default), STRING_BOTTOM or STRING_CENTER

Throws: IllegalArgumentException
If the value is invalid
See Also:
setLabel
 o getLabelWidth
  public int getLabelWidth()
Gets the LabelWidth value.

See Also:
setLabelWidth
 o setLabelWidth
  public synchronized void setLabelWidth(int v)
Sets the maximum number of characters which will be displayed, if ShowLabel is true (default: 4 if AutoLabel is true, 10 otherwise).

See Also:
setAutoLabel, setLabel, setShowLabel
 o getTimeElapsed
  public long getTimeElapsed()
Gets the time elapsed (in ms) since the minimum value was last set.

See Also:
setValues
 o getTimeToCompletion
  public long getTimeToCompletion()
Calculates an estimate of the time (in ms) before which the value will be 100%.

Returns:
BWTEnum.MAXINT if the value is equal to the minimum
See Also:
getTimeElapsed
 o getTimeToCompletionString
  public String getTimeToCompletionString()
Calculates an estimate of the time before which the value will be 100%.

Returns:
time in format HH:MM:SS, or "?" if the value is equal to the minimum
See Also:
getTimeElapsed
 o preferredWidth
  protected int preferredWidth()
Gets the subclass' preferred width (default: 100).

Overrides:
preferredWidth in class JCComponent
 o preferredHeight
  protected int preferredHeight()
Gets the subclass' preferred height (default: 100).

Overrides:
preferredHeight in class JCComponent
 o layout
  public void layout()
Lays out the component's internal elements.

Overrides:
layout in class JCComponent
 o drawShadow
  protected void drawShadow(Graphics gc)
Draws the shadow around the bar.

Overrides:
drawShadow in class JCComponent
 o drawBar
  protected void drawBar(Graphics gc)
Draws the bar.

 o drawLabel
  protected void drawLabel(Graphics gc,
                           String label)
Draws the label.

 o paintComponent
  protected void paintComponent(Graphics gc)
Draws the shadow, bar and label.

Overrides:
paintComponent in class JCComponent
See Also:
drawShadow, drawBar, drawLabel

All Packages  Class Hierarchy  This Package  Previous  Next  Index