I am using SwingWorker to execute some heavy load tasks on an application I am making . Although today I got across the Executor class and this example :
Executo
The SwingWorker has additional methods process() and done() which are automatically executed in the event dispatch thread. This comes in handy if you plan to display your progress or final results in a user interface.
1) SwingWorker
is created as bridge betweens Java Essentials Classes
and Swing by implements Future
, and quite guarantee that outoput from methods process
, publish
and done
will be on EventDispatchThread
2) you can invoke SwingWorker
from Executor
, this is most safiest methods how to create multithreading in Swing by implements SwingWorker
3) notice carefully with number or thread, because Executor
doesn't care somehow about SwingWorkers
life_cycle
4) another important notice and here
5) for listening states from SwingWorker
you have to implements PropertyChangeListener