superwaba.ext.xplat.ui
Class ProgressBar

java.lang.Object
  |
  +--waba.ui.Control
        |
        +--superwaba.ext.xplat.ui.ProgressBar

public class ProgressBar
extends Control

A basic progress bar, with the bar and a text


Field Summary
 Color fillColor
          The color used to fill progress bar.
 Color textColor
          The text color of the text of a progress bar.
 
Fields inherited from class waba.ui.Control
AFTER, appId, asContainer, asWindow, backColor, backDis, BEFORE, BOTTOM, CENTER, enabled, FILL, FIT, fm, fmH, focusLess, font, foreColor, foreDis, height, LEFT, parent, PREFERRED, RANGE, RIGHT, SAME, TOP, visible, width, x, x2, y, y2
 
Constructor Summary
ProgressBar()
          Creates a progress bar, String is set to null, which is the default.
ProgressBar(int mn, int mx)
          Creates a progress bar, String is set to null, which is the default.
 
Method Summary
 int getMaximum()
          Returns the model's maximum value.
 int getMinimum()
          Returns the model's minimum value.
 double getPercentComplete()
          Returns the percentage/percent complete for the progress bar.
 int getPreferredHeight()
          Returns the preffered height of this control.
 int getPreferredWidth()
          Returns the preffered width of this control.
 String getString()
          Returns the current value of the Progress String.
 int getValue()
          Returns the model's current value.
 void onPaint(Graphics g)
          Called to draw the control.
 void setMaximum(int n)
          Sets the model's maximum to n.
 void setMinimum(int n)
          Sets the model's minimum to n.
 void setString(String s)
          Sets the value of the Progress String.
 void setValue(int n)
          Sets the model's current value to x.
 
Methods inherited from class waba.ui.Control
addTimer, contains, createGraphics, getAbsoluteRect, getBackColor, getFont, getFontMetrics, getForeColor, getNext, getParent, getParentWindow, getPos, getRect, getSize, isDisplayed, isEnabled, isVisible, onBoundsChanged, onColorsChanged, onEvent, onFontChanged, onWindowPaintFinished, postEvent, removeTimer, repaint, repaintNow, requestFocus, setBackColor, setBackForeColors, setEnabled, setFocusLess, setFont, setForeColor, setRect, setRect, setRect, setVisible
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, toString, wait, wait
 

Field Detail

textColor

public Color textColor
The text color of the text of a progress bar.

fillColor

public Color fillColor
The color used to fill progress bar.
Constructor Detail

ProgressBar

public ProgressBar()
Creates a progress bar, String is set to null, which is the default. Uses the default minimum and maximum. Uses the default minimum for the initial value of the progress bar.

ProgressBar

public ProgressBar(int mn,
                   int mx)
Creates a progress bar, String is set to null, which is the default. Uses the specified minimum and maximum. Uses the specified minimum for the initial value of the progress bar.
Method Detail

getString

public String getString()
Returns the current value of the Progress String. If you are providing a custom Progress String via this method, you will want to ensure that you call setString() before you call getString();
Returns:
the value of the percent string
See Also:
setString(java.lang.String)

setString

public void setString(String s)
Sets the value of the Progress String. By default, this String is set to null. If you are providing a custom Progress String via this method, you will want to ensure that you call setString() before you call getString(). If you have provided a custom String and want to revert to the built-in behavior, set the String back to null.
Parameters:
s - the value of the percent string
See Also:
getString()

getPercentComplete

public double getPercentComplete()
Returns the percentage/percent complete for the progress bar. Note that, as a double, this number is between 0.00 and 1.00.
Returns:
the percent complete for this progress bar.

getPreferredWidth

public int getPreferredWidth()
Description copied from class: Control
Returns the preffered width of this control.
Overrides:
getPreferredWidth in class Control

getPreferredHeight

public int getPreferredHeight()
Description copied from class: Control
Returns the preffered height of this control.
Overrides:
getPreferredHeight in class Control

getValue

public int getValue()
Returns the model's current value. The value is always between the model's minimum and maximum values, inclusive. By default, the value equals the minimum.
Returns:
the value
See Also:
setValue(int)

getMinimum

public int getMinimum()
Returns the model's minimum value. By default, this is 0.
Returns:
an int -- the model's minimum
See Also:
setMinimum(int)

getMaximum

public int getMaximum()
Returns the model's maximum value. By default, this is 100.
Returns:
an int -- the model's maximum
See Also:
setMaximum(int)

setValue

public void setValue(int n)
Sets the model's current value to x. The underlying BoundedRangeModel will handle any mathematical issues arrising from assigning faulty values.
Parameters:
n - the new value
See Also:
getValue()

setMinimum

public void setMinimum(int n)
Sets the model's minimum to n.
Parameters:
n - the new minimum
See Also:
getMinimum()

setMaximum

public void setMaximum(int n)
Sets the model's maximum to n.
Parameters:
x - the new maximum
See Also:
getMaximum()

onPaint

public void onPaint(Graphics g)
Description copied from class: Control
Called to draw the control. When this method is called, the graphics object passed has been translated into the coordinate system of the control and the area behind the control has already been painted. The background is painted by the top-level window control.
Overrides:
onPaint in class Control
Tags copied from class: Control
Parameters:
g - the graphics object for drawing
See Also:
Graphics