    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

##

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

##

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

##

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

##

STRING_LEFT

     public static final int STRING_LEFT

STRING_RIGHT

     public static final int STRING_RIGHT

STRING_TOP

     public static final int STRING_TOP

STRING_BOTTOM

     public static final int STRING_BOTTOM

STRING_CENTER

     public static final int STRING_CENTER

label_inset

     protected int label_inset

  Space between label and bar area, if label is not centered.

bar_area

     protected Rectangle bar_area

  Bar area's bounding box

bar_rect

     protected Rectangle bar_rect

  Bar's drawn bounding box.

bar_height

     protected int bar_height

  Bar's height.

bar_vert_inset

     protected int bar_vert_inset

  Bar's top and bottom inset.

bar_horiz_inset

     protected int bar_horiz_inset

  Bar's left and right inset.

bar_shadow

     protected int bar_shadow

  Bar's shadow thickness.

##

JCProgressMeter

     public JCProgressMeter()

  Constructs a meter with a range of [0, 100].

  See Also:
    setValues

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

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

##

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

getValue

     public int getValue()

  Gets the current value.

getValuePercentage

     public int getValuePercentage()

  Gets the current value as a percentage of the range.

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

getMinimum

     public int getMinimum()

  Gets the minimum value.

  See Also:
    setValues

setMinimum

     public void setMinimum(int v)

  Sets the minimum value.

  See Also:
    setValues

getMaximum

     public int getMaximum()

  Gets the maximum value.

  See Also:
    setValues

setMaximum

     public void setMaximum(int v)

  Sets the maximum value.

  See Also:
    setValues

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

getBarColor

     public Color getBarColor()

  Gets the BarColor value.

  See Also:
    setBarColor

setBarColor

     public synchronized void setBarColor(Color v)

  Sets the bar's color (default: red).

getBarCount

     public int getBarCount()

  Gets the BarCount value.

  See Also:
    setBarCount

setBarCount

     public synchronized void setBarCount(int v)

  Sets the number of discrete bars eventually displayed (default: 10).

getBarSpacing

     public int getBarSpacing()

  Gets the BarSpacing value.

  See Also:
    setBarSpacing

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

getLabel

     public String getLabel()

  Gets the Label value.

  See Also:
    setLabel

setLabel

     public synchronized void setLabel(String s)

  Sets the label (default: null). If set, this value overrides the AutoLabel value.

  See Also:
    setAutoLabel, setLabelPosition

getAutoLabel

     public boolean getAutoLabel()

  Gets the AutoLabel value.

  See Also:
    setAutoLabel

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

getShowLabel

     public boolean getShowLabel()

  Gets the ShowLabel value.

  See Also:
    setShowLabel

setShowLabel

     public synchronized void setShowLabel(boolean v)

  If true (default), a label will be displayed.

  See Also:
    setAutoLabel, setLabel, setLabelPosition

getLabelPosition

     public int getLabelPosition()

  Gets the LabelPosition value.

  See Also:
    setLabelPosition

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

getLabelWidth

     public int getLabelWidth()

  Gets the LabelWidth value.

  See Also:
    setLabelWidth

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

getTimeElapsed

     public long getTimeElapsed()

  Gets the time elapsed (in ms) since the minimum value was last set.

  See Also:
    setValues

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

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

preferredWidth

     protected int preferredWidth()

  Gets the subclass' preferred width (default: 100).

  Overrides:
    preferredWidth in class JCComponent

preferredHeight

     protected int preferredHeight()

  Gets the subclass' preferred height (default: 100).

  Overrides:
    preferredHeight in class JCComponent

layout

     public void layout()

  Lays out the component's internal elements.

  Overrides:
    layout in class JCComponent

drawShadow

     protected void drawShadow(Graphics gc)

  Draws the shadow around the bar.

  Overrides:
    drawShadow in class JCComponent

drawBar

     protected void drawBar(Graphics gc)

  Draws the bar.

drawLabel

     protected void drawLabel(Graphics gc,
                              String label)

  Draws the label.

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