All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.sun.java.swing.JProgressBar

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----com.sun.java.swing.JComponent
                           |
                           +----com.sun.java.swing.JProgressBar

public class JProgressBar
extends JComponent
implements SwingConstants
A control that displays an integer value within a bounded interval. A progress bar typically communicates the progress of an event by displaying its percentage of completion. The orientation of the progress bar depends on its size; i.e. if its height is greater than its width, it is vertical.


Variable Index

 o barModel
 o changeEvent
 o changeListener
 o changeListenerList
 o orientation
 o paintBackground
 o paintBorder

Constructor Index

 o JProgressBar()
Creates a horizontal progress bar with a border.

Method Index

 o addChangeListener(ChangeListener)
 o createChangeListener()
 o getMaximum()
 o getMinimum()
 o getModel()
 o getOrientation()
Returns JProgressBar.VERTICAL or JProgressBar.HORIZONTAL depending on the orientation of the progress bar.
 o getUI()
 o getValue()
Returns the value.
 o isBackgroundPainted()
Returns true if the progress bar is painting its background or false if it does not.
 o isBorderPainted()
Returns true if the progress bar has a border or false if it does not.
 o isOpaque()
 o removeChangeListener(ChangeListener)
 o setBackgroundPainted(boolean)
Sets whether the progress bar should paint its background.
 o setBorderPainted(boolean)
Sets whether the progress bar should have a border.
 o setMaximum(int)
Sets the maximum to x.
 o setMinimum(int)
Sets the model's minimum to x.
 o setModel(BoundedRangeModel)
 o setOrientation(int)
Sets the progress bar's orientation to newOrientation, which must be JProgressBar.VERTICAL or JProgressBar.HORIZONTAL.
 o setUI(ProgressBarUI)
 o setValue(int)
Sets the value to x.
 o update(Graphics)
Overridden to call paint without filling the background.
 o updateUI()
Called to replace the UI with the latest version from the default UIFactory.

Variables

 o orientation
 protected int orientation
 o paintBorder
 protected boolean paintBorder
 o paintBackground
 protected boolean paintBackground
 o barModel
 protected BoundedRangeModel barModel
 o changeListenerList
 protected ChangeListener changeListenerList
 o changeListener
 protected ChangeListener changeListener
 o changeEvent
 protected final ChangeEvent changeEvent

Constructors

 o JProgressBar
 public JProgressBar()
Creates a horizontal progress bar with a border.

Methods

 o update
 public void update(Graphics g)
Overridden to call paint without filling the background.

Overrides:
update in class Container
 o getOrientation
 public int getOrientation()
Returns JProgressBar.VERTICAL or JProgressBar.HORIZONTAL depending on the orientation of the progress bar. A progress bar's default orientation is HORIZONTAL.

Returns:
HORIZONTAL or VERTICAL
 o setOrientation
 public void setOrientation(int newOrientation)
Sets the progress bar's orientation to newOrientation, which must be JProgressBar.VERTICAL or JProgressBar.HORIZONTAL. A progress bar's default orientation is HORIZONTAL.

Parameters:
newOrientation - HORIZONTAL or VERTICAL
Throws: IllegalArgumentException
if newOrientation is an illegal value
 o isBorderPainted
 public boolean isBorderPainted()
Returns true if the progress bar has a border or false if it does not.

Returns:
whether the progress bar has a border
See Also:
setBorderPainted
 o setBorderPainted
 public void setBorderPainted(boolean b)
Sets whether the progress bar should have a border.

Parameters:
b - true if the progress bar should have a border
See Also:
isBorderPainted
 o isBackgroundPainted
 public boolean isBackgroundPainted()
Returns true if the progress bar is painting its background or false if it does not.

Returns:
whether the progress bar draws its background
See Also:
setBackgroundPainted
 o isOpaque
 public boolean isOpaque()
Overrides:
isOpaque in class JComponent
 o setBackgroundPainted
 public void setBackgroundPainted(boolean b)
Sets whether the progress bar should paint its background.

Parameters:
b - true if the progress bar should paint its background
See Also:
isBackgroundPainted
 o getUI
 public ProgressBarUI getUI()
 o setUI
 public void setUI(ProgressBarUI ui)
 o updateUI
 public void updateUI()
Called to replace the UI with the latest version from the default UIFactory.

Overrides:
updateUI in class JComponent
 o createChangeListener
 protected ChangeListener createChangeListener()
 o addChangeListener
 public void addChangeListener(ChangeListener l)
 o removeChangeListener
 public void removeChangeListener(ChangeListener l)
 o getModel
 public BoundedRangeModel getModel()
 o setModel
 public void setModel(BoundedRangeModel newModel)
 o getValue
 public int getValue()
Returns the value. The value is always between the minimum and maximum, inclusive.

Returns:
the value
See Also:
setValue
 o getMinimum
 public int getMinimum()
Returns:
the minimum
See Also:
setMinimum
 o getMaximum
 public int getMaximum()
Returns:
the maximum
See Also:
setMaximum
 o setValue
 public void setValue(int n)
Sets the value to x. If x is less than the minimum or greater than the maximum, this method throws IllegalArgumentException and the value is not changed.

Notifies any listeners if the data changes.

Parameters:
x - the new value
Throws: IllegalArgumentException
if x is outside the legal range
See Also:
getValue
 o setMinimum
 public void setMinimum(int n)
Sets the model's minimum to x. If the current maximum or value is outside of the new minimum, the maximum or value is adjusted accordingly.

Notifies any listeners if the data changes.

Parameters:
x - the new minimum
See Also:
getMinimum, addChangeListener
 o setMaximum
 public void setMaximum(int n)
Sets the maximum to x. If the current minimum or value is outside of the new maximum, the minimum or value is adjusted accordingly.

Notifies any listeners if the data changes.

Parameters:
x - the new maximum
See Also:
getMaximum, addChangeListener

All Packages  Class Hierarchy  This Package  Previous  Next  Index