Class AMDProgressBar
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Canvas
|
+----AMDProgressBar
- public class AMDProgressBar
- extends Canvas
A ProgressBar is a widget which indicates how close a task is to
completion. The developer can create a progress bar, draw it
somewhere on screen, and make the bar move from 0% to 100% while
the rest of the program does something time consuming.
There are two versions of the progress bar, one which is a subclass
of an AWT component, and one which can be embedded in the drawing
area of other components. AMDProgressBar acts as a standard AWT
component.
A progress bar looks like this:

Version: 0.90 09 Dec 1996
Author: Adam Doppelt
- See Also:
- AMDProgressBarEmbed
-
AMDProgressBar()
- Constructs a progress bar.
-
paint(Graphics)
- Paint the progress bar.
-
reshape(int, int, int, int)
- Resize the progress bar.
-
setBackgroundColors(Color, Color)
- Set the colors of the top and bottom half of the background inside
the box.
-
setBarColor(Color)
- Set the color of the bar itself.
-
setBorderColors(Color, Color)
- Set the colors of the outer and inner borders on the box.
-
setBoxColors(Color, Color)
- Set the colors of the high and low points of the sine box
surrounding the bar.
-
setFont(Font)
- Set the font of the text.
-
setPercent(double)
- Set the percent of the progress bar.
-
setSineProperties(int, int)
- Set some properties of the sine box.
-
setText(String)
- Set the text which should be drawn in the center of the bar.
-
setTextColors(Color, Color)
- Set the colors of the text and its shadow.
-
update(Graphics)
- Update the progress bar.
AMDProgressBar
public AMDProgressBar()
- Constructs a progress bar.
reshape
public void reshape(int x,
int y,
int width,
int height)
- Resize the progress bar.
- Parameters:
- x - The new x location with the parent.
- y - The new y location with the parent.
- width - The new width of the bar, from outer border on the
left to outer border on the right.
- height - The new height of the bar, from outer border on the
top to outer border on the bottom.
- Overrides:
- reshape in class Component
update
public void update(Graphics g)
- Update the progress bar. AWT calls this.
- Overrides:
- update in class Component
paint
public void paint(Graphics g)
- Paint the progress bar. AWT calls this.
- Overrides:
- paint in class Canvas
setPercent
public void setPercent(double percent)
- Set the percent of the progress bar.
- Parameters:
- percent - The new percent, with 0.0 being completely empty and
1.0 completely full.
setText
public void setText(String text)
- Set the text which should be drawn in the center of the bar.
- Parameters:
- text - The text to draw. If null is passed, the current
percent will be drawn.
setBorderColors
public void setBorderColors(Color outer,
Color inner)
- Set the colors of the outer and inner borders on the box.
- Parameters:
- outer - The color of the 1 pixel border outside the colored box.
- inner - The color of the 1 pixel border just inside the colored box.
setBoxColors
public void setBoxColors(Color a,
Color b)
- Set the colors of the high and low points of the sine box
surrounding the bar. Note that the actual color will walk in a sine
wave between the two colors passed here. The sine wave will crawl
from the upperleft corner, clockwise around the box. If a == b, the
box will be drawn in a single color.
- Parameters:
- a - The color of the first peak of the sine wave.
- b - The color of the other peak of the sine wave.
setBarColor
public void setBarColor(Color bar)
- Set the color of the bar itself.
- Parameters:
- bar - The color of the bar.
setBackgroundColors
public void setBackgroundColors(Color top,
Color bottom)
- Set the colors of the top and bottom half of the background inside
the box.
- Parameters:
- top - The color of the top half of the background.
- bottom - The color of the bottom half of the background.
setTextColors
public void setTextColors(Color text,
Color shadow)
- Set the colors of the text and its shadow.
- Parameters:
- text - The color of the text in the middle of the box.
- shadow - The color of the shadow on the text.
setFont
public void setFont(Font font)
- Set the font of the text.
- Parameters:
- font - The font of the text in the middle of the box.
- Overrides:
- setFont in class Component
setSineProperties
public void setSineProperties(int period,
int segmentSize)
- Set some properties of the sine box.
- Parameters:
- period - The distance in pixels between two peaks in the sine
box.
- segmentSize - The size in pixels of each colored segment in
the sine box.