| GNU Classpath (0.95) | |
| Prev Class | Next Class | Frames | No Frames |
| Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Objectjava.awt.Componentjava.awt.Containerjavax.swing.JComponentjavax.swing.JProgressBarJProgressBar fills a percentage of its bar based on its
current value. In indeterminate mode, it creates box and bounces it between
its bounds.
This component has the following properties:
| Property | Stored in | Bound? |
|---|---|---|
| borderPainted | progressBar | yes |
| changeListeners | progressBar | no |
| indeterminate | progressBar | yes |
| maximum | model | no |
| minimum | model | no |
| model | progressBar | no |
| orientation | progressBar | yes |
| percentComplete | progressBar | no |
| string | progressBar | yes |
| stringPainted | progressBar | yes |
| value | model | no |
Nested Class Summary | |
protected class |
|
Nested classes/interfaces inherited from class javax.swing.JComponent | |
JComponent.AccessibleJComponent | |
Nested classes/interfaces inherited from class java.awt.Container | |
Container.AccessibleAWTContainer | |
Nested classes/interfaces inherited from class java.awt.Component | |
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy | |
Field Summary | |
protected ChangeEvent |
|
protected ChangeListener |
|
protected BoundedRangeModel |
|
protected int |
|
protected boolean |
|
protected boolean |
|
protected String |
|
Fields inherited from class javax.swing.JComponent | |
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW, accessibleContext, listenerList, ui | |
Fields inherited from class java.awt.Component | |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT | |
Fields inherited from interface java.awt.image.ImageObserver | |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH | |
Fields inherited from interface javax.swing.SwingConstants | |
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST | |
Constructor Summary | |
| |
| |
| |
| |
| |
Method Summary | |
void |
|
protected ChangeListener |
|
protected void |
|
AccessibleContext |
|
ChangeListener[] |
|
int |
|
int |
|
BoundedRangeModel |
|
int |
|
double |
|
String |
|
ProgressBarUI |
|
String |
|
int |
|
boolean |
|
boolean |
|
boolean |
|
protected void |
|
protected String |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void | |
Methods inherited from class java.lang.Object | |
clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait | |
protected ChangeEvent changeEvent
A single change event reused for all events.
- See Also:
fireStateChanged()
protected ChangeListener changeListener
The listener that is registered with the model.
protected BoundedRangeModel model
The model defining the bounds and current value for the progress bar.
- See Also:
setModel(BoundedRangeModel)
protected int orientation
The orientation of theJProgressBar(SwingConstants.HORIZONTALorSwingConstants.VERTICAL). Defaults toSwingConstants.HORIZONTAL.
- See Also:
setOrientation(int)
protected boolean paintBorder
A flag the controls whether or not the component's border is painted. The default istrue.
- See Also:
setBorderPainted(boolean)
protected boolean paintString
A flag that controls whether a string is displayed within the progress bar.
- See Also:
setStringPainted(boolean)
protected String progressString
A custom string for display in the progress bar. If this isnull, a default string will be generated.
- See Also:
setString(String)
public JProgressBar()
Creates a newJProgressBarwith default attributes. The following defaults are used:
value: 0;minimum: 0;maximum: 100;orientation:SwingConstants.HORIZONTAL.
public JProgressBar(int orientation)
Creates a newJProgressBarwith the specifiedorientation. The following defaults are used:
value: 0;minimum: 0;maximum: 100;
- Parameters:
orientation- the orientation (SwingConstants.HORIZONTALorSwingConstants.VERTICAL).
- Throws:
IllegalArgumentException- iforientationis not one of the specified values.
public JProgressBar(int minimum, int maximum)
Creates a newJProgressBarwith the specified value range. The following defaults are used:
value:minimum;orientation:SwingConstants.HORIZONTAL.
- Parameters:
minimum- the lower bound of the value range.maximum- the upper bound of the value range.
public JProgressBar(int orientation, int minimum, int maximum)
Creates a newJProgressBarwith the specified range and orientation. The following defaults are used:
value:minimum;
- Parameters:
orientation- the orientation (SwingConstants.HORIZONTALorSwingConstants.VERTICAL).minimum- the lower bound of the value range.maximum- the upper bound of the value range.
- Throws:
IllegalArgumentException- iforientationis not one of the specified values.
public JProgressBar(BoundedRangeModel model)
Creates a newJProgressBarwith the specified model. The following defaults are used:
orientation:SwingConstants.HORIZONTAL.
- Parameters:
model- the model (nullnot permitted).
public void addChangeListener(ChangeListener listener)
Registers a listener with this component so that it will receive notification of component state changes.
- Parameters:
listener- the listener.
- See Also:
removeChangeListener(ChangeListener)
protected ChangeListener createChangeListener()
Creates a newChangeListenerthat callsfireStateChanged()whenever it receives aChangeEvent(typically from the component'smodel). This listener is registered with the progress bar's model, so that changes made to the model directly will automatically result in the progress bar's listeners being notified also.
- Returns:
- A new listener.
protected void fireStateChanged()
Sends aChangeEventto all registered listeners to indicate that the state of theJProgressBarhas changed.
- See Also:
createChangeListener()
public AccessibleContext getAccessibleContext()
Returns the object that provides accessibility features for thisJProgressBarcomponent.
- Specified by:
- getAccessibleContext in interface Accessible
- Overrides:
- getAccessibleContext in interface JComponent
- Returns:
- The accessible context (an instance of
JProgressBar.AccessibleJProgressBar).
public ChangeListener[] getChangeListeners()
Returns an array of the listeners that are registered with this component. The array may be empty, but is nevernull.
- Returns:
- An array of listeners.
- Since:
- 1.4
public int getMaximum()
Returns the maximum value for theJProgressBar. This defines the upper bound for the current value, and is stored in the component'smodel.
- Returns:
- The maximum value.
- See Also:
setMaximum(int)
public int getMinimum()
Returns the minimum value for theJProgressBar. This defines the lower bound for the current value, and is stored in the component'smodel.
- Returns:
- The minimum value.
- See Also:
setMinimum(int)
public BoundedRangeModel getModel()
Returns the model for theJProgressBar.
- Returns:
- The model (never
null).
- See Also:
setModel(BoundedRangeModel)
public int getOrientation()
Returns the orientation of theJProgressBarcomponent, which is eitherSwingConstants.HORIZONTALorSwingConstants.VERTICAL. The default orientation isHORIZONTAL.
- Returns:
- The orientation.
- See Also:
setOrientation(int)
public double getPercentComplete()
Returns the current value expressed as a percentage. This is calculated as(value - min) / (max - min).
- Returns:
- The percentage (a value in the range 0.0 to 1.0).
public String getString()
Returns the string that is painted on theJProgressBarifisStringPainted()returnstrue. If no string has been explicitly set, this method will return a string displaying the value ofgetPercentComplete().
- Returns:
- The string.
- See Also:
setString(String),setStringPainted(boolean)
public ProgressBarUI getUI()
Returns the UI delegate for thisJProgressBar.
- Returns:
- The UI delegate.
public String getUIClassID()
Returns the suffix ("ProgressBarUI"in this case) used to determine the class name for a UI delegate that can provide the look and feel for aJProgressBar.
- Overrides:
- getUIClassID in interface JComponent
- Returns:
"ProgressBarUI".
public int getValue()
Returns the current value for theJProgressBar. This value is fetched from the model.
- Returns:
- The current value.
- See Also:
setValue(int)
public boolean isBorderPainted()
Returns a flag that controls whether or not the component's border is painted. The default value istrue.
- Returns:
trueif the component's border should be painted, andfalseotherwise.
- See Also:
setBorderPainted(boolean)
public boolean isIndeterminate()
Returns a flag that indicates the mode for thisJProgressBar(truefor indeterminate mode, andfalsefor determinate mode).
- Returns:
- A flag indicating the mode for the
JProgressBar.
- Since:
- 1.4
- See Also:
setIndeterminate(boolean)
public boolean isStringPainted()
Returns the flag that controls whether or not the string returned bygetString()is displayed by theJProgressBarcomponent.
- Returns:
trueif the string should be displayed, andfalseotherwise.
- See Also:
setStringPainted(boolean)
protected void paintBorder(Graphics graphics)
Paints the component's border, but only ifisBorderPainted()returnstrue.
- Overrides:
- paintBorder in interface JComponent
- Parameters:
graphics- the graphics object to paint with.
- See Also:
setBorderPainted(boolean)
protected String paramString()
Returns an implementation-dependent string describing the attributes of thisJProgressBar.<
- Overrides:
- paramString in interface JComponent