I want to make a background task in one thread and send information from that thread to another thread which runs the main program and update the information each period of time.
Thread1:
public void doTask()
{
// ...
someData = ...;
}
Thread2:
SwingUtilities.invokeLater(new Runnable()
{
public void run()
{
new MainFrame(someData);
}
});
How could I achieve this in java?
I using Executor/ExecutorService, output from these methods starting java.swing.Action (create a new EDT if doesn’t exists),
or you can test that For EDT
both ways for your Wratever sould be always in EDT, I vote for wraps output to the GUI into
Action