waba.ui
Class ProgressBar

java.lang.Object
  |
  +--waba.ui.Control
        |
        +--waba.ui.ProgressBar

public class ProgressBar
extends Control

A basic progress bar, with the bar and a text. This version is simplier than the one provided in the package superwaba.ext.xplat.ui.


Field Summary
 boolean drawBorder
          If false, no border is drawn.
 int max
          The maximum value of a progress bar.
 int min
          The minimum value of a progress bar.
 java.lang.String prefix
          The string prefix.
 java.lang.String suffix
          The string prefix.
 Color textColor
          The text color
 
Fields inherited from class waba.ui.Control
AFTER, appId, appObj, asContainer, asWindow, backColor, backDis, BEFORE, BOTTOM, CENTER, clearValueInt, clearValueStr, enabled, FILL, FIT, fm, fmH, focusLess, focusTraversable, font, foreColor, foreDis, height, highlightRectsCount, isHighlighting, LEFT, parent, PREFERRED, RANGE, RIGHT, SAME, TOP, uiCE, uiFlat, uiPalm, uiVista, visible, width, x, x2, y, y2
 
Constructor Summary
ProgressBar()
          Creates a progress bar, with minimum and maximum set as 0 and 100, respectively.
ProgressBar(int min, int max)
          Creates a progress bar, String is set to null, which is the default.
 
Method Summary
 void clear()
          Clears this control, setting the value to clearValueInt.
 int getPreferredHeight()
          Returns the preferred height, which is fmH+2
 int getPreferredWidth()
          Gets the preferred width, which is the parent's width-6, or the screen's width.
 int getValue()
          Returns the current value
 void onPaint(Graphics g)
          Paint the Progress Bar.
 void setValue(int n)
          Sets the current value.
 void setValue(int value, java.lang.String prefix, java.lang.String suffix)
          Sets the current value and the prefix and suffix.
 
Methods inherited from class waba.ui.Control
addTimer, changeHighlighted, contains, createGraphics, drawHighlight, 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, translateFromOrigin, uiStyleChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

min

public int min
The minimum value of a progress bar.

max

public int max
The maximum value of a progress bar.

prefix

public java.lang.String prefix
The string prefix. The displayed label will be prefix+value+sufix. The default is an empty string.

suffix

public java.lang.String suffix
The string prefix. The displayed label will be prefix+value+sufix. The default is the percentage symbol.

textColor

public Color textColor
The text color

drawBorder

public boolean drawBorder
If false, no border is drawn.
Constructor Detail

ProgressBar

public ProgressBar()
Creates a progress bar, with minimum and maximum set as 0 and 100, respectively.

ProgressBar

public ProgressBar(int min,
                   int max)
Creates a progress bar, String is set to null, which is the default. Uses the specified minimum for the initial value of the progress bar.
Parameters:
min - The minimum value
max - The maximum value
Method Detail

getPreferredWidth

public int getPreferredWidth()
Gets the preferred width, which is the parent's width-6, or the screen's width.
Overrides:
getPreferredWidth in class Control

getPreferredHeight

public int getPreferredHeight()
Returns the preferred height, which is fmH+2
Overrides:
getPreferredHeight in class Control

setValue

public void setValue(int n)
Sets the current value. Due to performance reasons, min and max are not verified. If the value was not changed, nothing happens. The progress bar is repainted immediately.
Parameters:
n - The new value
See Also:
getValue()

setValue

public void setValue(int value,
                     java.lang.String prefix,
                     java.lang.String suffix)
Sets the current value and the prefix and suffix. Note that, due to performance reasons, min and max are not verified. This does not check if the value had changed; it always repaint the progress bar immediately.
Parameters:
value - The new value
See Also:
getValue()

getValue

public int getValue()
Returns the current value

onPaint

public void onPaint(Graphics g)
Paint the Progress Bar. The filled part of the bar is painted with the foreground color; the empty part of the bar is painted with the background color; the text is painted with the defined textColor color; no border is drawn.
Overrides:
onPaint in class Control
Tags copied from class: Control
Parameters:
g - the graphics object for drawing
See Also:
Graphics

clear

public void clear()
Clears this control, setting the value to clearValueInt.
Overrides:
clear in class Control