I have a couple of questions with regards to Swing and using EDT for GUI updates. I just started reading on this stuff so I am a full beginner in this area:
SwingWorker ensure that done() method is run on EDT via below code:
Runnable doDone =
new Runnable() {
public void run() {
done();
}
};
if (SwingUtilities.isEventDispatchThread()) {
doDone.run();
} else {
doSubmit.add(doDone);
}
Actually it add the doDone variable into AccumulativeRunnable doSubmit,
See the source code of AccumulativeRunnable.java you will find there has a below code
protected void submit() {
SwingUtilities.invokeLater(this);
}
That's why swingworker ensure the method done() running on EDT