All Packages  Class Hierarchy  This Package  Previous  Next  Index  

Class java.awt.swing.JProgressBar

java.lang.Object
    |
    +----java.awt.Component
            |
            +----java.awt.Container
                    |
                    +----java.awt.swing.JComponent
                            |
                            +----java.awt.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.


Class Index

 o JProgressBar.ModelListener

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 getAccessibleStateSet()
Get the state set of this object.
 o getAccessibleValue()
Get the accessible value of this object.
 o getMaximum()
 o getMaximumAccessibleValue()
Get the maximum accessible value of this object.
 o getMinimum()
 o getMinimumAccessibleValue()
Get the minimum accessible value of this object.
 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 setAccessibleValue(Number)
Set the value of this object as a Number.
 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 JComponent
 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 getAccessibleStateSet
public AccessibleStateSet getAccessibleStateSet()
Get the state set of this object.

Returns:
an instance of AccessibleState containing the current state of the object
Overrides:
getAccessibleStateSet in class JComponent
See Also:
AccessibleState
 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 Number getAccessibleValue()
Get the accessible value of this object.

Returns:
The current value of this object.
Overrides:
getAccessibleValue in class JComponent
 o setAccessibleValue
public boolean setAccessibleValue(Number n)
Set the value of this object as a Number.

Returns:
True if the value was set.
Overrides:
setAccessibleValue in class JComponent
 o getMinimumAccessibleValue
public Number getMinimumAccessibleValue()
Get the minimum accessible value of this object.

Returns:
The minimum value of this object.
Overrides:
getMinimumAccessibleValue in class JComponent
 o getMaximumAccessibleValue
public Number getMaximumAccessibleValue()
Get the maximum accessible value of this object.

Returns:
The maximum value of this object.
Overrides:
getMaximumAccessibleValue in class JComponent

All Packages  Class Hierarchy  This Package  Previous  Next  Index  

Submit a bug or feature