java swing worker thread to wait for EDT
问题 I've got a worker thread that should wait for EDT to update the GUI before continuing execution. I've used the publish method to tell EDT to change something. How can i make the worker wait for that change to take place? 回答1: If it is also your same worker thread that is initiating the GUI changes, then there's a ready-built mechanism for waiting for those changes to be made: SwingUtilities.invokeAndWait() should fit the bill nicely. Another alternative would be to use SwingUtilities