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

Constructor Index

 o AMDProgressBar()
Constructs a progress bar.

Method Index

 o paint(Graphics)
Paint the progress bar.
 o reshape(int, int, int, int)
Resize the progress bar.
 o setBackgroundColors(Color, Color)
Set the colors of the top and bottom half of the background inside the box.
 o setBarColor(Color)
Set the color of the bar itself.
 o setBorderColors(Color, Color)
Set the colors of the outer and inner borders on the box.
 o setBoxColors(Color, Color)
Set the colors of the high and low points of the sine box surrounding the bar.
 o setFont(Font)
Set the font of the text.
 o setPercent(double)
Set the percent of the progress bar.
 o setSineProperties(int, int)
Set some properties of the sine box.
 o setText(String)
Set the text which should be drawn in the center of the bar.
 o setTextColors(Color, Color)
Set the colors of the text and its shadow.
 o update(Graphics)
Update the progress bar.

Constructors

 o AMDProgressBar
 public AMDProgressBar()
Constructs a progress bar.

Methods

 o 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
 o update
 public void update(Graphics g)
Update the progress bar. AWT calls this.

Overrides:
update in class Component
 o paint
 public void paint(Graphics g)
Paint the progress bar. AWT calls this.

Overrides:
paint in class Canvas
 o 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.
 o 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.
 o 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.
 o 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.
 o setBarColor
 public void setBarColor(Color bar)
Set the color of the bar itself.

Parameters:
bar - The color of the bar.
 o 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.
 o 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.
 o 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
 o 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.