All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.sun.wizards.awt.ProgressBar

java.lang.Object
   |
   +----java.awt.Component
           |
           +----com.sun.wizards.awt.ProgressBar

public class ProgressBar
extends Component
ProgressBar is a Component that indicates percentage completion of a process that has a lengthy execution time.

The ProgressBar object itself does not calculate the percentage complete. The progress must be set periodically using the setProgress method.

Graphic of a ProgressBar displaying 75% completion.

Here is the code for this applet:


 import java.applet.Applet;
 import java.awt.*;
 import com.sun.wizards.awt.*;
 public class Test extends Applet
 {
   public void init()
     {
       setLayout(new GridBagLayout());
       ProgressBar progressBar = new ProgressBar();
       progressBar.setProgress(75);
       add(progressBar);
     }
 }
 


Variable Index

 o depth
The depth is the variable that gives the illusion that the progress bar stands above its owner panel.
 o progress
The current progress.
 o size
The preferred size of this progress bar.

Constructor Index

 o ProgressBar()
Creates a progress bar.

Method Index

 o drawProgress(Graphics, int, int)
Draw the progress within the progress bar with the specified Graphics.
 o drawProgressBorder(Graphics)
Draw the progress bar border.
 o getDepth()
Returns the current depth of the progress bar.
 o getMinimumSize()
Returns the minimum size of this progress bar.
 o getPreferredSize()
Returns the preferred size of this progress bar.
 o getProgress()
Returns the current progress being displayed by this progress bar.
 o paint(Graphics)
Paints the entire progress bar.
 o setDepth(int)
Set the depth of the progress bar border.
 o setProgress(int)
Set the progress that this progress bar should display.
 o setSize(Dimension)
Sets the size of this progress bar.

Variables

 o size
 protected Dimension size
The preferred size of this progress bar.

 o progress
 protected int progress
The current progress.

 o depth
 protected int depth
The depth is the variable that gives the illusion that the progress bar stands above its owner panel.

Constructors

 o ProgressBar
 public ProgressBar()
Creates a progress bar.

Methods

 o setSize
 public void setSize(Dimension newSize)
Sets the size of this progress bar.

Parameters:
newSize - The new size for this progress bar.
Overrides:
setSize in class Component
 o setDepth
 public void setDepth(int depth)
Set the depth of the progress bar border. The larger the depth value is, the higher the progress bar appears to stand above the panel.

Parameters:
depth - The new depth.
 o getDepth
 public int getDepth()
Returns the current depth of the progress bar.

Returns:
The current depth.
 o getPreferredSize
 public Dimension getPreferredSize()
Returns the preferred size of this progress bar.

Returns:
The preferred size.
Overrides:
getPreferredSize in class Component
 o getMinimumSize
 public Dimension getMinimumSize()
Returns the minimum size of this progress bar.

Returns:
The minimum size.
Overrides:
getMinimumSize in class Component
 o setProgress
 public void setProgress(int progress)
Set the progress that this progress bar should display.

Parameters:
progress - The new progress.
 o getProgress
 public int getProgress()
Returns the current progress being displayed by this progress bar.

Returns:
The current progress.
 o paint
 public void paint(Graphics g)
Paints the entire progress bar. For progress updates, drawProgress should be used because it does not repaint the borders.

Parameters:
g - The Graphics window.
Overrides:
paint in class Component
 o drawProgress
 protected void drawProgress(Graphics g,
                             int previousProgress,
                             int currentProgress)
Draw the progress within the progress bar with the specified Graphics. Only the difference between the previous progress and the current progress will be drawn.

Parameters:
g - The Graphics to use when drawing the progress.
previousProgress - The previous progress value.
currentProgress - The current progress value.
 o drawProgressBorder
 protected void drawProgressBorder(Graphics g)
Draw the progress bar border.

Parameters:
g - The Graphics to use when drawing the progress barr border.

All Packages  Class Hierarchy  This Package  Previous  Next  Index