From time to time, when the Dialog box is visible, the progress bar will be updated when setProgress is called. setProgress won't always update the progress bar, it will only be done if the amount of progress is visibly significant.
For further documentation and examples see How to Monitor Progress, a section in The Java Tutorial.
ProgressMonitorInputStream
Modifier and Type | Class and Description |
---|---|
protected class | ProgressMonitor.
|
private class |
Modifier and Type | Field and Description |
---|---|
protected AccessibleContext | accessibleContext
The |
private AccessibleContext | |
private Object[] | |
private JDialog | |
private int | |
private Object | |
private int | |
private int | |
private int | |
private JProgressBar | |
private String | |
private JLabel | |
private JOptionPane | |
private Component | |
private ProgressMonitor | |
private long |
Access | Constructor and Description |
---|---|
public | ProgressMonitor(Component
the parent component for the dialog box parentComponent, Object a descriptive message that will be shown
to the user to indicate what operation is being monitored.
This does not change as the operation progresses.
See the message parameters to methods in
message, String JOptionPane#message
for the range of values.a short note describing the state of the
operation. As the operation progresses, you can call
setNote to change the note displayed. This is used,
for example, in operations that iterate through a
list of files to show the name of the file being processes.
If note is initially null, there will be no note line
in the dialog box and setNote will be ineffective note, int the lower bound of the range min, int the upper bound of the range max)Constructs a graphic object that shows progress, typically by filling in a rectangular bar as the process nears completion. |
private | ProgressMonitor(Component parentComponent, Object message, String note, int min, int max, ProgressMonitor group)
|
Modifier and Type | Method and Description |
---|---|
public void | |
public AccessibleContext | Returns: theAccessibleContext for the
ProgressMonitor Implements javax. AccessibleContext for the
ProgressMonitor
|
public int | Returns: an int representing the maximum valueReturns the maximum value -- the higher end of the progress value. |
public int | Returns: the amount of time in milliseconds this object waits before deciding whether or not to popup a progress monitorReturns the amount of time this object waits before deciding whether or not to popup a progress monitor. |
public int | Returns: the amount of time in milliseconds it will take for the popup to appearReturns the amount of time it will take for the popup to appear. |
public int | Returns: an int representing the minimum valueReturns the minimum value -- the lower end of the progress value. |
public String | Returns: a String specifying the note to displaySpecifies the additional note that is displayed along with the progress message. |
public boolean | Returns: true if the user hits the Cancel button or closes the progress dialogReturns true if the user hits the Cancel button or closes the progress dialog. |
public void | |
public void | setMillisToDecideToPopup(int
an int specifying the time to wait,
in milliseconds millisToDecideToPopup)Specifies the amount of time to wait before deciding whether or not to popup a progress monitor. |
public void | setMillisToPopup(int
an int specifying the time in milliseconds millisToPopup)Specifies the amount of time it will take for the popup to appear. |
public void | |
public void | |
public void | setProgress(int
an int specifying the current value, between the
maximum and minimum specified for this component nv)Indicate the progress of the operation being monitored. |
accessibleContext | back to summary |
---|---|
protected AccessibleContext accessibleContext The
|
accessibleJOptionPane | back to summary |
---|---|
private AccessibleContext accessibleJOptionPane |
cancelOption | back to summary |
---|---|
private Object[] cancelOption |
dialog | back to summary |
---|---|
private JDialog dialog |
max | back to summary |
---|---|
private int max |
message | back to summary |
---|---|
private Object message |
millisToDecideToPopup | back to summary |
---|---|
private int millisToDecideToPopup |
millisToPopup | back to summary |
---|---|
private int millisToPopup |
min | back to summary |
---|---|
private int min |
myBar | back to summary |
---|---|
private JProgressBar myBar |
note | back to summary |
---|---|
private String note |
noteLabel | back to summary |
---|---|
private JLabel noteLabel |
pane | back to summary |
---|---|
private JOptionPane pane |
parentComponent | back to summary |
---|---|
private Component parentComponent |
root | back to summary |
---|---|
private ProgressMonitor root |
T0 | back to summary |
---|---|
private long T0 |
ProgressMonitor | back to summary |
---|---|
public ProgressMonitor(Component parentComponent, Object message, String note, int min, int max) Constructs a graphic object that shows progress, typically by filling in a rectangular bar as the process nears completion.
|
ProgressMonitor | back to summary |
---|---|
private ProgressMonitor(Component parentComponent, Object message, String note, int min, int max, ProgressMonitor group) |
close | back to summary |
---|---|
public void close() Indicate that the operation is complete. This happens automatically when the value set by setProgress is >= max, but it may be called earlier if the operation ends early. |
getAccessibleContext | back to summary |
---|---|
public AccessibleContext getAccessibleContext() Implements javax. Gets the
|
getMaximum | back to summary |
---|---|
public int getMaximum() Returns the maximum value -- the higher end of the progress value.
|
getMillisToDecideToPopup | back to summary |
---|---|
public int getMillisToDecideToPopup() Returns the amount of time this object waits before deciding whether or not to popup a progress monitor.
|
getMillisToPopup | back to summary |
---|---|
public int getMillisToPopup() Returns the amount of time it will take for the popup to appear.
|
getMinimum | back to summary |
---|---|
public int getMinimum() Returns the minimum value -- the lower end of the progress value.
|
getNote | back to summary |
---|---|
public String getNote() Specifies the additional note that is displayed along with the progress message. |
isCanceled | back to summary |
---|---|
public boolean isCanceled() Returns true if the user hits the Cancel button or closes the progress dialog.
|
setMaximum | back to summary |
---|---|
public void setMaximum(int m) Specifies the maximum value.
|
setMillisToDecideToPopup | back to summary |
---|---|
public void setMillisToDecideToPopup(int millisToDecideToPopup) Specifies the amount of time to wait before deciding whether or not to popup a progress monitor.
|
setMillisToPopup | back to summary |
---|---|
public void setMillisToPopup(int millisToPopup) Specifies the amount of time it will take for the popup to appear. (If the predicted time remaining is less than this time, the popup won't be displayed.)
|
setMinimum | back to summary |
---|---|
public void setMinimum(int m) Specifies the minimum value.
|
setNote | back to summary |
---|---|
public void setNote(String note) Specifies the additional note that is displayed along with the progress message. Used, for example, to show which file the is currently being copied during a multiple-file copy. |
setProgress | back to summary |
---|---|
public void setProgress(int nv) Indicate the progress of the operation being monitored. If the specified value is >= the maximum, the progress monitor is closed.
|
AccessibleProgressMonitor
implements accessibility
support for the ProgressMonitor
class.
Modifier and Type | Field and Description |
---|---|
private Object |
Access | Constructor and Description |
---|---|
protected |
Modifier and Type | Method and Description |
---|---|
public Accessible | Returns: the Accessible child of the objectzero-based index of child i)Implements abstract javax. |
public int | Returns: the number of accessible children of the object.Implements abstract javax. |
public AccessibleComponent | Returns: AccessibleComponent if supported by object; else return nullOverrides javax. |
public String | Returns: the localized description of the object; null if this object does not have a descriptionOverrides javax. |
public int | Returns: the 0-based index of this object in its parent; -1 if this object does not have an accessible parent.Implements abstract javax. |
public String | Returns: the localized name of the object; null if this object does not have a nameOverrides javax. |
public Accessible | Returns: the Accessible parent of this object; null if this object does not have an Accessible parentOverrides javax. |
public AccessibleRole | Returns: an instance of AccessibleRole describing the role of the objectImplements abstract javax. |
public AccessibleStateSet | Returns: an instance of AccessibleStateSet containing the current state set of the objectImplements abstract javax. |
public AccessibleText | Returns: AccessibleText if supported by object; else return nullOverrides javax. |
public AccessibleValue | Returns: AccessibleValue if supported by object; else return nullOverrides javax. |
public String | Returns: the letter, word, or sentencethe CHARACTER, WORD, or SENTENCE to retrieve part, int an index within the text index)Implements javax. |
public String | Returns: the letter, word, or sentencethe CHARACTER, WORD, or SENTENCE to retrieve part, int an index within the text index)Implements javax. |
public String | Returns: the letter, word, or sentencethe CHARACTER, WORD, or SENTENCE to retrieve part, int an index within the text index)Implements javax. |
public int | Returns: the zero-based offset of the caret.Implements javax. |
public AttributeSet | Returns: the AttributeSet of the characterthe zero-based index into the text i)Implements javax. |
public Rectangle | Returns: the screen coordinates of the character's bounding box, if index is invalid return an empty rectangle.the index into the String i)Implements javax. |
public int | Returns: the number of charactersImplements javax. |
public int | Returns: the zero-based index of the character under Point p; if Point is invalid return -1.the Point in local coordinates p)Implements javax. |
public Locale | Returns: this component's locale. If this component does not have a locale, the locale of its parent is returned.Implements abstract javax. |
private AccessibleText | |
private AccessibleContext | |
private AccessibleContext | |
public String | Returns: the String portion of the text that is selectedImplements javax. |
public int | Returns: the index into the text of the end of the selectionImplements javax. |
public int | Returns: the index into the text of the start of the selectionImplements javax. |
private void | |
public void | propertyChange(PropertyChangeEvent
A e)PropertyChangeEvent object describing
the event source and the property that has changed. Must not be null.Implements java. |
private boolean | |
public void | stateChanged(ChangeEvent
a e)ChangeEvent object. Must not be null.Implements javax. |
oldModelValue | back to summary |
---|---|
private Object oldModelValue |
AccessibleProgressMonitor | back to summary |
---|---|
protected AccessibleProgressMonitor() AccessibleProgressMonitor constructor |
getAccessibleChild | back to summary |
---|---|
public Accessible getAccessibleChild(int i) Implements abstract javax. Returns the specified Accessible child of the object. The Accessible children of an Accessible object are zero-based, so the first child of an Accessible child is at index 0, the second child is at index 1, and so on.
|
getAccessibleChildrenCount | back to summary |
---|---|
public int getAccessibleChildrenCount() Implements abstract javax. Returns the number of accessible children of the object.
|
getAccessibleComponent | back to summary |
---|---|
public AccessibleComponent getAccessibleComponent() Overrides javax. Gets the AccessibleComponent associated with this object that has a graphical representation.
|
getAccessibleDescription | back to summary |
---|---|
public String getAccessibleDescription() Overrides javax. Gets the accessibleDescription property of this object. The accessibleDescription property of this object is a short localized phrase describing the purpose of the object. For example, in the case of a 'Cancel' button, the accessibleDescription could be 'Ignore changes and close dialog box.'
|
getAccessibleIndexInParent | back to summary |
---|---|
public int getAccessibleIndexInParent() Implements abstract javax. Gets the 0-based index of this object in its accessible parent.
|
getAccessibleName | back to summary |
---|---|
public String getAccessibleName() Overrides javax. Gets the accessibleName property of this object. The accessibleName property of an object is a localized String that designates the purpose of the object. For example, the accessibleName property of a label or button might be the text of the label or button itself. In the case of an object that doesn't display its name, the accessibleName should still be set. For example, in the case of a text field used to enter the name of a city, the accessibleName for the en_US locale could be 'city.'
|
getAccessibleParent | back to summary |
---|---|
public Accessible getAccessibleParent() Overrides javax. Gets the Accessible parent of this object.
|
getAccessibleRole | back to summary |
---|---|
public AccessibleRole getAccessibleRole() Implements abstract javax. Gets the role of this object. The role of the object is the generic purpose or use of the class of this object. For example, the role of a push button is AccessibleRole.PUSH_BUTTON. The roles in AccessibleRole are provided so component developers can pick from a set of predefined roles. This enables assistive technologies to provide a consistent interface to various tweaked subclasses of components (e.g., use AccessibleRole.PUSH_BUTTON for all components that act like a push button) as well as distinguish between subclasses that behave differently (e.g., AccessibleRole.CHECK_BOX for check boxes and AccessibleRole.RADIO_BUTTON for radio buttons). Note that the AccessibleRole class is also extensible, so custom component developers can define their own AccessibleRole's if the set of predefined roles is inadequate.
|
getAccessibleStateSet | back to summary |
---|---|
public AccessibleStateSet getAccessibleStateSet() Implements abstract javax. Gets the state set of this object. The AccessibleStateSet of an object is composed of a set of unique AccessibleStates. A change in the AccessibleStateSet of an object will cause a PropertyChangeEvent to be fired for the ACCESSIBLE_STATE_PROPERTY property.
|
getAccessibleText | back to summary |
---|---|
public AccessibleText getAccessibleText() Overrides javax. Gets the AccessibleText associated with this object presenting text on the display.
|
getAccessibleValue | back to summary |
---|---|
public AccessibleValue getAccessibleValue() Overrides javax. Gets the AccessibleValue associated with this object that supports a Numerical value.
|
getAfterIndex | back to summary |
---|---|
public String getAfterIndex(int part, int index) Implements javax. Returns the String after a given index.
|
getAtIndex | back to summary |
---|---|
public String getAtIndex(int part, int index) Implements javax. Returns the String at a given index.
|
getBeforeIndex | back to summary |
---|---|
public String getBeforeIndex(int part, int index) Implements javax. Returns the String before a given index.
|
getCaretPosition | back to summary |
---|---|
public int getCaretPosition() Implements javax. Returns the zero-based offset of the caret. Note That to the right of the caret will have the same index value as the offset (the caret is between two characters).
|
getCharacterAttribute | back to summary |
---|---|
public AttributeSet getCharacterAttribute(int i) Implements javax. Returns the AttributeSet for a given character at a given index
|
getCharacterBounds | back to summary |
---|---|
public Rectangle getCharacterBounds(int i) Implements javax. Determines the bounding box of the character at the given index into the string. The bounds are returned in local coordinates. If the index is invalid an empty rectangle is returned.
|
getCharCount | back to summary |
---|---|
public int getCharCount() Implements javax. Returns the number of characters (valid indices)
|
getIndexAtPoint | back to summary |
---|---|
public int getIndexAtPoint(Point p) Implements javax. Given a point in local coordinates, return the zero-based index of the character under that Point. If the point is invalid, this method returns -1.
|
getLocale | back to summary |
---|---|
public Locale getLocale() throws IllegalComponentStateException Implements abstract javax. Gets the locale of the component. If the component does not have a locale, then the locale of its parent is returned.
|
getNoteLabelAccessibleText | back to summary |
---|---|
private AccessibleText getNoteLabelAccessibleText() |
getPanelAccessibleContext | back to summary |
---|---|
private AccessibleContext getPanelAccessibleContext() |
getParentAccessibleContext | back to summary |
---|---|
private AccessibleContext getParentAccessibleContext() |
getSelectedText | back to summary |
---|---|
public String getSelectedText() Implements javax. Returns the portion of the text that is selected.
|
getSelectionEnd | back to summary |
---|---|
public int getSelectionEnd() Implements javax. Returns the end offset within the selected text. If there is no selection, but there is a caret, the start and end offsets will be the same.
|
getSelectionStart | back to summary |
---|---|
public int getSelectionStart() Implements javax. Returns the start offset within the selected text. If there is no selection, but there is a caret, the start and end offsets will be the same.
|
optionPaneCreated | back to summary |
---|---|
private void optionPaneCreated() |
propertyChange | back to summary |
---|---|
public void propertyChange(PropertyChangeEvent e) Implements java. This method gets called when a bound property is changed.
|
sameWindowAncestor | back to summary |
---|---|
private boolean sameWindowAncestor(Component src, Component dest) |
stateChanged | back to summary |
---|---|
public void stateChanged(ChangeEvent e) Implements javax. Invoked when the target of the listener has changed its state.
|
Access | Constructor and Description |
---|---|
pack-priv |
Modifier and Type | Method and Description |
---|---|
public JDialog | createDialog(Component
determines the frame in which the dialog
is displayed; if the parentComponent, String parentComponent has
no Frame , a default Frame is usedthe title string for the dialog title)Overrides javax. JDialog wrapping
this centered on the parentComponent
in the parentComponent 's frame.
|
public AccessibleContext | Returns: the AccessibleContext for the ProgressOptionPaneOverrides javax. Implements javax. |
private AccessibleContext | |
public int | getMaxCharactersPerLineCount()
Overrides javax. |
ProgressOptionPane | back to summary |
---|---|
pack-priv ProgressOptionPane(Object messageList) |
createDialog | back to summary |
---|---|
public JDialog createDialog(Component parentComponent, String title) Overrides javax. Doc from javax. Creates and returns a new |
getAccessibleContext | back to summary |
---|---|
public AccessibleContext getAccessibleContext() Overrides javax. Implements javax. Gets the AccessibleContext for the ProgressOptionPane
|
getAccessibleJOptionPane | back to summary |
---|---|
private AccessibleContext getAccessibleJOptionPane() |
getMaxCharactersPerLineCount | back to summary |
---|---|
public int getMaxCharactersPerLineCount() Overrides javax. Doc from javax. Returns the maximum number of characters to place on a line in a
message. Default is to return
|