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, Accessible
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 opaque
 o orientation
 o paintBorder

Constructor Index

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

Method Index

 o addChangeListener(ChangeListener)
Adds a ChangeListener to the button.
 o createChangeListener()
 o fireStateChanged()
 o getAccessibleRole()
Get the role of this object.
 o getAccessibleValue()
Get the accessible value of this object.
 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 getUIClassID()
 o getValue()
Returns the value.
 o isBorderPainted()
Returns true if the progress bar has a border or false if it does not.
 o isOpaque()
Returns true if the progress bar is painting its background or false if it does not.
 o paintBorder(Graphics)
Paint the progress bar's border if BorderPainted property is true.
 o removeChangeListener(ChangeListener)
Removes a ChangeListener from the button.
 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 setOpaque(boolean)
Sets whether the progress bar should paint its background.
 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 opaque
 protected boolean opaque
 o barModel
 protected BoundedRangeModel barModel
 o changeEvent
 protected transient ChangeEvent changeEvent
 o changeListener
 protected ChangeListener changeListener

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 paintBorder
 protected void paintBorder(Graphics g)
Paint the progress bar's border if BorderPainted property is true.

Overrides:
paintBorder in class JComponent
See Also:
paint, setBorder
 o isOpaque
 public boolean isOpaque()
Returns true if the progress bar is painting its background or false if it does not.

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

Parameters:
opaque - true if the progress bar should paint its background
See Also:
isOpaque
 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 getUIClassID
 public String getUIClassID()
Returns:
"ProgressBarUI"
Overrides:
getUIClassID in class JComponent
See Also:
getUIClassID, getUI
 o createChangeListener
 protected ChangeListener createChangeListener()
 o addChangeListener
 public void addChangeListener(ChangeListener l)
Adds a ChangeListener to the button.

 o removeChangeListener
 public void removeChangeListener(ChangeListener l)
Removes a ChangeListener from the button.

 o fireStateChanged
 protected void fireStateChanged()
 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
 o getAccessibleRole
 public AccessibleRole getAccessibleRole()
Get the role of this object.

Returns:
an instance of AccessibleRole describing the role of the object
Overrides:
getAccessibleRole in class JComponent
 o getAccessibleValue
 public String getAccessibleValue()
Get the accessible value of this object.

Returns:
a localized String describing the value of this object
Overrides:
getAccessibleValue in class JComponent

All Packages  Class Hierarchy  This Package  Previous  Next  Index