The common way to interact with EDT from swing worker is useing get() method. But i have a long task and code like this:
public Void doInBackground() {
for(Object o : objects) {
doSomething();
MyGlobalGUIConsole.addMessage("Done for " + o);
}
}
In most tutotials is recommended to use return values to get something back from SwingWorker to EDT, but can i just:
public Void doInBackground() {
for(Object o : objects) {
doSomething();
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
MyGlobalGUIConsole.addMessage("Done for " + o);
}
});
}
}