Package 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);

## Field Summary

Fields
Modifier and Type
Field
Description
`protected int`
`maximum`
`protected JProgressBar`
`progressBar`
`protected boolean`
`stringPainted`
`protected int`
`value`

## Constructor Summary

Constructors
Constructor
Description
`SafeProgressBarUpdaterThread(JProgressBar progressBar)`

## Method Summary

Modifier and Type
Method
Description
`void`
`endProgressBar()`
`static void`
`endProgressBar(SafeProgressBarUpdaterThread progressBarUpdater)`
`JProgressBar`
`getProgressBar()`
`void`
`run()`
`void`
`setMaximum(int maximum)`
`void`
`setStringPainted(boolean b)`
`void`
`setValue(int value)`
`void`
`startProgressBar()`
`void`
`startProgressBar(int maximum)`
`static void`
`startProgressBar(SafeProgressBarUpdaterThread progressBarUpdater)`
`static void`
`startProgressBar(SafeProgressBarUpdaterThread progressBarUpdater, int maximum)`
`void`
`updateProgressBar(int value)`
`void`
`updateProgressBar(int value, int maximum)`
`static void`
`updateProgressBar(SafeProgressBarUpdaterThread progressBarUpdater, int value)`
`static void`
`updateProgressBar(SafeProgressBarUpdaterThread progressBarUpdater, int value, int maximum)`

### Methods inherited from class java.lang.Object

`clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### progressBar

protected JProgressBar progressBar

### value

protected int value

### maximum

protected int maximum

### stringPainted

protected boolean stringPainted

## Constructor Details

### SafeProgressBarUpdaterThread

public SafeProgressBarUpdaterThread(JProgressBar progressBar)

## Method Details

### 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)