Waiting for thread while updating Swing
问题 I have problem with handling threads in my application. It creates JFrame and starts a new Thread. Last one will execute external application and update GUI. Then I have problem to make Main class to wait for second thread to finish, but also to update GUI simultaneously. Here's my example (shortened): class Main { public int status; public Main() { // Creating GUI etc. SwingUtilities.invokeLater(new Runnable() { public void run() { JDialog id = new JDialog(); id.button.addMouseListener(new