buoy.widget
Class BProgressBar

java.lang.Object
  extended by buoy.event.EventSource
      extended by buoy.widget.Widget
          extended by buoy.widget.BProgressBar

public class BProgressBar
extends Widget

BProgressBar is a Widget that displays the status of some operation. It is a horizontal or vertical bar that gradually fills up to indicate what fraction of the operation is complete. It optionally can also display a line of text describing the current state of the operation.

You can specify minimum and maximum progress values for the bar, to reflect the number of steps in the operation being monitored. When the current progress value is equal to the minimum value, the bar is shown completely empty. When it is equal to the maximum value, the bar is shown completely full.

If you do not know how long an operation will take, the progress bar can be put into an "indeterminate" state. This causes the entire bar to animate continuously to show that work is being done.

Author:
Peter Eastman

Nested Class Summary
static class BProgressBar.Orientation
          This inner class represents an orientation (horizontal or vertical) for the split.
 
Field Summary
static BProgressBar.Orientation HORIZONTAL
           
static BProgressBar.Orientation VERTICAL
           
 
Constructor Summary
BProgressBar()
          Create a horizontal BProgressBar which does not display text.
BProgressBar(BProgressBar.Orientation orient, int min, int max)
          Create a new BProgressBar.
BProgressBar(int min, int max)
          Create a horizontal BProgressBar which does not display text.
 
Method Summary
 javax.swing.JProgressBar getComponent()
          Get the java.awt.Component corresponding to this Widget.
 int getMaximum()
          Get the progress bar's maximum progress value.
 int getMinimum()
          Get the progress bar's minimum progress value.
 BProgressBar.Orientation getOrientation()
          Get the progress bar's orientation, HORIZONTAL or VERTICAL.
 java.lang.String getProgressText()
          Get the line of text displayed on the progress bar.
 boolean getShowProgressText()
          Get whether the progress bar displays a line of text describing the operation whose progress is being monitored.
 int getValue()
          Get the progress bar's current progress value.
 boolean isIndeterminate()
          Get whether this progress bar is in indeterminate mode.
 void setIndeterminate(boolean indeterminate)
          Set whether this progress bar is in indeterminate mode.
 void setMaximum(int max)
          Set the progress bar's maximum progress value.
 void setMinimum(int min)
          Set the progress bar's minimum progress value.
 void setOrientation(BProgressBar.Orientation orient)
          Set the progress bar's orientation, HORIZONTAL or VERTICAL.
 void setProgressText(java.lang.String text)
          Set the line of text displayed on the progress bar.
 void setShowProgressText(boolean show)
          Set whether the progress bar displays a line of text describing the operation whose progress is being monitored.
 void setValue(int value)
          Set the progress bar's current progress value.
 
Methods inherited from class buoy.widget.Widget
addEventLink, dispatchEvent, getBackground, getBounds, getCursor, getFont, getMaximumSize, getMinimumSize, getName, getParent, getPreferredSize, hasFocus, isEnabled, isFocusable, isVisible, repaint, requestFocus, setBackground, setCursor, setEnabled, setFocusable, setFont, setName, setVisible
 
Methods inherited from class buoy.event.EventSource
addEventLink, addEventLink, removeEventLink
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HORIZONTAL

public static final BProgressBar.Orientation HORIZONTAL

VERTICAL

public static final BProgressBar.Orientation VERTICAL
Constructor Detail

BProgressBar

public BProgressBar()
Create a horizontal BProgressBar which does not display text. The minimum and maximum progress values are 0 and 100, respectively.


BProgressBar

public BProgressBar(int min,
                    int max)
Create a horizontal BProgressBar which does not display text. The initial progress value is set to min.

Parameters:
min - the minimum value on the progress bar
max - the maximum value on the progress bar

BProgressBar

public BProgressBar(BProgressBar.Orientation orient,
                    int min,
                    int max)
Create a new BProgressBar. The initial progress value is set to min.

Parameters:
orient - the progress bar orientation (HORIZONTAL or VERTICAL)
min - the minimum value on the progress bar
max - the maximum value on the progress bar
Method Detail

getComponent

public javax.swing.JProgressBar getComponent()
Description copied from class: Widget
Get the java.awt.Component corresponding to this Widget.

Overrides:
getComponent in class Widget

getValue

public int getValue()
Get the progress bar's current progress value.


setValue

public void setValue(int value)
Set the progress bar's current progress value.


getMinimum

public int getMinimum()
Get the progress bar's minimum progress value.


setMinimum

public void setMinimum(int min)
Set the progress bar's minimum progress value.


getMaximum

public int getMaximum()
Get the progress bar's maximum progress value.


setMaximum

public void setMaximum(int max)
Set the progress bar's maximum progress value.


getOrientation

public BProgressBar.Orientation getOrientation()
Get the progress bar's orientation, HORIZONTAL or VERTICAL.


setOrientation

public void setOrientation(BProgressBar.Orientation orient)
Set the progress bar's orientation, HORIZONTAL or VERTICAL.


isIndeterminate

public boolean isIndeterminate()
Get whether this progress bar is in indeterminate mode. In indeterminate mode, the entire progress bar animates continuously to show that work is being done, but no indication is given of how much remains.


setIndeterminate

public void setIndeterminate(boolean indeterminate)
Set whether this progress bar is in indeterminate mode. In indeterminate mode, the entire progress bar animates continuously to show that work is being done, but no indication is given of how much remains.


getShowProgressText

public boolean getShowProgressText()
Get whether the progress bar displays a line of text describing the operation whose progress is being monitored.


setShowProgressText

public void setShowProgressText(boolean show)
Set whether the progress bar displays a line of text describing the operation whose progress is being monitored.


getProgressText

public java.lang.String getProgressText()
Get the line of text displayed on the progress bar. This text is only shown if setShowProgessText(true) has been called.


setProgressText

public void setProgressText(java.lang.String text)
Set the line of text displayed on the progress bar. This text is only shown if setShowProgessText(true) has been called.



Written by Peter Eastman.