|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--java.awt.Component
|
+--java.awt.Container
|
+--java.awt.Window
|
+--java.awt.Dialog
|
+--javax.swing.JDialog
|
+--net.agmodel.dialog.SlowTaskDialog
A dialog to help the user manage a slow running task.
Includes a progress bar, which can run indeterminately if necessary, a status message, and a cancel button.
| Field Summary | |
static String |
CANCELBUTTONNAME
The name of the cancel button - used in the ActionEvent sent when the cancel button is clicked. |
| Fields inherited from class javax.swing.JDialog |
accessibleContext, rootPane, rootPaneCheckingEnabled |
| Fields inherited from class java.awt.Dialog |
|
| Fields inherited from class java.awt.Window |
|
| Fields inherited from class java.awt.Container |
|
| Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface javax.swing.WindowConstants |
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSE |
| Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
SlowTaskDialog()
Create a default non-modal dialog not linked to any frame. |
|
SlowTaskDialog(Frame frame,
String title,
boolean modal)
Creates a dialog (but doesn't display it). |
|
| Method Summary | |
void |
addCancelListener(ActionListener cancelListener)
Add a listener to be notified if the user clicks the cancel button |
void |
appear()
Make the dialog appear, and start the progress bar running if autoProgress. |
void |
disappear()
Hide the dialog, and stop the progess bar running if it is. |
(package private) void |
jbInit()
|
void |
setAutoProgress(boolean autoProgress)
If set true, the progress bar will steadily converge toward the right side, but never reach it. |
void |
setMessage(String text)
Set the status message to appear in a JLabel above the progress bar. |
void |
setProgress(int percent)
Set the progress bar to a particular position. |
void |
setProgressBarFractionUpdate(int fractionRemaining)
Set the fraction of the remaining space "chewed up" by the progress bar on each refresh interval. |
void |
setProgressBarRefresh(int refreshms)
Set how often the progress bar updates when in autoProgress mode. |
| Methods inherited from class java.awt.Dialog |
addNotify, dispose, getTitle, hide, isModal, isResizable, isUndecorated, setModal, setResizable, setTitle, setUndecorated, show |
| Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final String CANCELBUTTONNAME
| Constructor Detail |
public SlowTaskDialog(Frame frame,
String title,
boolean modal)
frame - the parent frame (can use JOptionPane.getFrameForComponent())title - a title for the dialog.modal - whether the dialog prevents other components from having the focus.public SlowTaskDialog()
| Method Detail |
void jbInit()
throws Exception
Exceptionpublic void addCancelListener(ActionListener cancelListener)
cancelListener - public void setAutoProgress(boolean autoProgress)
autoProgress - use true in situations where you don't know how long a task will take.public void appear()
public void disappear()
public void setProgress(int percent)
percent - 0 - left hand side, 100 - right hand sidepublic void setProgressBarRefresh(int refreshms)
refreshms - the refresh interval in milliseconds.setProgressBarFractionUpdate(int)public void setProgressBarFractionUpdate(int fractionRemaining)
fractionRemaining - to consume quarter of the remaining empty space each refresh, use 4, to consume one third, use 3...setProgressBarRefresh(int)public void setMessage(String text)
text - the status message.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||