title: Refreshing GUI by another thread in java (swing)
body: <p>I have a main program, in which GUI is based on swing and depending on one of four states the GUI elements have different parameters.</p>
  
  <pre><code>public class Frame extends JFrame implements Runnable {
  Status status = 1;
  ...
  @Override
  public void run() {
      switch (status) {
          case 1:
          ...
          case 2:
          ...
  }
  
  public void updateGUI(Status status) {
     this.status = status;
     SwingUtilities.invokeLater(this);
  }
  </code></pre>
  
  <p>And if I want to refresh the GUI invokes only updateGUI with appropriate parameter, and everything is fine. But the program also creates an additional thread, which after processing the relevant data should change the GUI main program. Unfortunately I can not in this thread call the method updateGUI (..).</p>
  
  <p>I know that I can use invokeLater or SwingWorker to refresh but there are more than 10 elements so I would rather use the method udpateGUI ().</p>
  
  <p>I will be grateful for any hint.</p>