In your code:
ScheduledExecutorService ex = Executors.newSingleThreadScheduledExecutor();
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
ex.schedule(new UpdatingService(), 1, TimeUnit.MILLISECONDS);
}
});
The only code executed on the EDT here is the ex.schedule
invocation. The code that is then invoked by the scheduler later, eg new UpdatingService()
will run on the thread that is internal to the scheduler, which will not be the EDT but some thread created by the call to Executors.newSingleThreadScheduledExecutor
Perhaps what I would do is have your scheduler schedule an update method (your updating service perhaps), which itself then puts a call onto the EDT via invokeLater.
Eg, something like:
ScheduledExecutorService ex = Executors.newSingleThreadScheduledExecutor();
ex.schedule(new Updater(), 1, TimeUnit.MILLISECONDS);
...
class Updater extends Runnable {
@Override
public void run() {
// invoke the EDT via Swing Utilities here.
}
}
This is my best advice without seeing what the rest of your code is doing.