Java - SwingWorker - Can we call one SwingWorker from other SwingWorker instead of EDT
- by Yatendra Goel
I have a SwingWorker as follows:
public class MainWorker extends SwingWorker(Void, MyObject) {
:
:
}
I invoked the above Swing Worker from EDT:
MainWorker mainWorker = new MainWorker();
mainWorker.execute();
Now, the mainWorker creates 10 instances of a MyTask class so that each instance will run on its own thread so as to complete the work faster.
But the problem is I want to update the gui from time to time while the tasks are running. I know that if the task was executed by the mainWorker itself, I could have used publish() and process() methods to update the gui.
But as the tasks are executed by threads different from the Swingworker thread, how can I update the gui from intermediate results generated by threads executing tasks.