All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Container
|
+----javax.swing.JComponent
|
+----org.ajug.jsl.jester.ui.ProgressBar
Color.green.
To indicate an exception has occurred, set the foregound color
to Color.red. For simplicity the minimum is always
zero.
To restart the progress bar for another suite run, simply
set the foreground color to green, maximum to number of tests,
and value to zero.
The unit test is java org.ajug.jsl.jester.ui.ProgressBar.
See this for a simple demo of how to use this class.
-
ProgressBar()
- Creates a ProgressBar with a lowered bevel border and defaults.
-
actionPerformed(ActionEvent)
- Used for the unit test.
-
getBackgroundColor()
- Returns the current background color.
-
getForegroundColor()
- Returns the current foreground color.
-
getMaximum()
- Returns the current maximum.
-
getMinimumSize()
-
-
getPreferredSize()
-
-
getValue()
- Returns the current value, which is always in the zero to
maximum range.
-
main(String[])
- Runs the unit test.
-
paintComponent(Graphics)
- Paints the component in the usual progress bar style.
-
runUnitTest()
- Runs a simple unit test in a Frame.
-
setBackgroundColor(Color)
- Sets the background color.
-
setBounds(int,
int, int, int)
-
-
setForegroundColor(Color)
- Sets the foreground color, which is used to display progress.
-
setMaximum(int)
- Sets the maximum progress anticipated.
-
setSize(int,
int)
-
-
setValue(int)
- Sets the current value, which indicates progress relative to
the maximum.
ProgressBar
public ProgressBar()
- Creates a ProgressBar with a lowered bevel border and defaults.
setForegroundColor
public void setForegroundColor(Color color)
- Sets the foreground color, which is used to display progress.
The default is
Color.green.
getForegroundColor
public Color getForegroundColor()
- Returns the current foreground color.
setBackgroundColor
public void setBackgroundColor(Color color)
- Sets the background color.
The default is
Color.lightGray.
getBackgroundColor
public Color getBackgroundColor()
- Returns the current background color.
setValue
public void setValue(int value)
- Sets the current value, which indicates progress relative to
the maximum. Setting the value will cause a repaint to show the
new progress.
If the value is below zero it's automatically changed to zero.
If above the maximum it's automatically changed to the maximum.
This prevents unpredictable behavior in the progress bar and
makes it easier to use.
getValue
public int getValue()
- Returns the current value, which is always in the zero to
maximum range.
setMaximum
public void setMaximum(int maximum)
- Sets the maximum progress anticipated. This should be done before
using the progress bar to display progress. The default is 10.
Values below zero are not allowed.
getMaximum
public int getMaximum()
- Returns the current maximum.
main
public static void main(String args[])
- Runs the unit test.
paintComponent
public void paintComponent(Graphics g)
- Paints the component in the usual progress bar style. First the
background is painted using the background color. Then the
foreground is painted using the foreground color, but only the
portion representing percent progress. This is calculated by the
formula
(value / maximum).
- Overrides:
- paintComponent in class JComponent
setSize
public void setSize(int width,
int height)
- Overrides:
- setSize in class Component
setBounds
public void setBounds(int x,
int y,
int width,
int height)
- Overrides:
- setBounds in class Component
getPreferredSize
public Dimension getPreferredSize()
- Overrides:
- getPreferredSize in class JComponent
getMinimumSize
public Dimension getMinimumSize()
- Overrides:
- getMinimumSize in class JComponent
actionPerformed
public void actionPerformed(ActionEvent evt)
- Used for the unit test.
runUnitTest
public void runUnitTest()
- Runs a simple unit test in a Frame. Clicking on the Increment
button will cause the progress bar to advance one value.
All Packages Class Hierarchy This Package Previous Next Index