Java - SwingWorker - Can we call one SwingWorker from other SwingWorker instead of EDT
Posted
by Yatendra Goel
on Stack Overflow
See other posts from Stack Overflow
or by Yatendra Goel
Published on 2010-05-09T11:29:40Z
Indexed on
2010/05/09
11:38 UTC
Read the original article
Hit count: 410
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.
© Stack Overflow or respective owner