com.pixelmed.display
Class SafeProgressBarUpdaterThread
java.lang.Object
com.pixelmed.display.SafeProgressBarUpdaterThread
- All Implemented Interfaces:
- Runnable
public class SafeProgressBarUpdaterThread
- extends Object
- implements Runnable
A class that implements Runnable so that it can be invoked by EventQueue.invokeLater().
This is needed, for example, to call from a worker thread, since the progress bar methods used MUST be invoked on the AWT Event Dispatch Thread.
So, for example, instead of directly accessing the JProgressBar methods:
progressBar.setMaximum(maximum);
progressBar.setValue(value);
progressBar.repaint();
do the following instead:
progressBarUpdater = new SafeProgressBarUpdaterThread(progressBar);
...
progressBarUpdater.setMaximum(maximum);
progressBarUpdater.setValue(value);
java.awt.EventQueue.invokeLater(progressBarUpdater);
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
progressBar
protected JProgressBar progressBar
value
protected int value
maximum
protected int maximum
stringPainted
protected boolean stringPainted
SafeProgressBarUpdaterThread
public SafeProgressBarUpdaterThread(JProgressBar progressBar)
run
public void run()
- Specified by:
run in interface Runnable
setValue
public void setValue(int value)
setMaximum
public void setMaximum(int maximum)
setStringPainted
public void setStringPainted(boolean b)
getProgressBar
public JProgressBar getProgressBar()
startProgressBar
public void startProgressBar(int maximum)
startProgressBar
public void startProgressBar()
updateProgressBar
public void updateProgressBar(int value)
updateProgressBar
public void updateProgressBar(int value,
int maximum)
endProgressBar
public void endProgressBar()
startProgressBar
public static void startProgressBar(SafeProgressBarUpdaterThread progressBarUpdater,
int maximum)
startProgressBar
public static void startProgressBar(SafeProgressBarUpdaterThread progressBarUpdater)
updateProgressBar
public static void updateProgressBar(SafeProgressBarUpdaterThread progressBarUpdater,
int value)
updateProgressBar
public static void updateProgressBar(SafeProgressBarUpdaterThread progressBarUpdater,
int value,
int maximum)
endProgressBar
public static void endProgressBar(SafeProgressBarUpdaterThread progressBarUpdater)