The ProgressBar provides the user with feedback while a long-running process is in progress. The dialog consists of a label known as the progressText, a progress indicator, and another label known as the stepText.

The progress indicator displayed is the javax.swing.JProgressBar

Client code must implement the Runnable interface in order to use the ProgressBar. The ProgressBar will create a new thread and invoke the run() method in the Runnable passed in via the constructor. This is done so the UI can be repainted while the long-running process is executing. Extension developers should not rely on the fact that this class implements ActionListener and Runnable. These are implementation details of this class, and should not have been exposed. Extension developers should also assume that this class is final.

hasUserCancelled()
The client code's run() method that implements the long-running process should call this method to determine if the user has pressed the Cancel button on the ProgressBar's dialog to terminate the long-running process.

updateProgress(int completionStatus, java.lang.String progressText, java.lang.String stepText)
The client code's run() method that implements the long-running process should use this method to update the ProgressBar to indicate the progress made in the long-running process.

void

updateProgress(java.lang.String progressText, java.lang.String stepText)
The client code's run() method that implements the long-running process should use this method to update the ProgressBar to indicate the progress made in the long-running process.

void

waitUntilDone()
The client code should call this to wait until the long-running process is complete.

updateProgress

The client code's run() method that implements the long-running process should use this method to update the ProgressBar to indicate the progress made in the long-running process. Use this method only when the indicator used is the JProgressBar not the BusyBar.

Parameters:

completionStatus - The amount of progress that has been made.

progressText - The text to display just above the progress indicator. If a null string or zero-length string is passed in the text will not be updated.

stepText - The text to display just below the progress indicator. If a null string or zero-length string is passed in the text will not be updated.

getCompletionStatus

public int getCompletionStatus()

Gets the amount of progress that has been reported so far.

updateProgress

The client code's run() method that implements the long-running process should use this method to update the ProgressBar to indicate the progress made in the long-running process. Use this method only when the indicator used is the BusyBar not the JProgressBar.

Parameters:

progressText - The text to display just above the progress indicator. If a null string or zero-length string is passed in the text will not be updated.

stepText - The text to display just below the progress indicator. If a null string or zero-length string is passed in the text will not be updated.

hasUserCancelled

public boolean hasUserCancelled()

The client code's run() method that implements the long-running process should call this method to determine if the user has pressed the Cancel button on the ProgressBar's dialog to terminate the long-running process. The long-running process should call this method fairly often and should clean up as necessary if the Cancel button has been pressed.

Returns:

true if the user has pressed the cancel button, false otherwise.

sleepForUIToRepaint

public void sleepForUIToRepaint()

The client code should call this in it's run() method that implements the long-running process. This method forces the long-running process to sleep for a little bit periodically to give the UI thread a chance to repaint. Every second or so force a sleep to make sure the UI has caught up.

waitUntilDone

public void waitUntilDone()

The client code should call this to wait until the long-running process is complete. ### Provide sample implementation ###

setDoneStatus

public void setDoneStatus()

The client code should call this when the long-running process is complete. ### provide sample implementation ###