1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16:
public class MyClass { private JProgressBar progressBar; <init stuff> class Task extends SwingWorker<Void, Void> { // Main task. Executed in background thread. @Override public Void doInBackground() { setProgress(10); doSomeStuff();