title: Java: A Thread don't modify the GUI even with SwingUtilities.invokeLater
body: <p>I have a problem with this code:</p>
  
  <pre><code>public class Gui_01 extends JFrame {
  
  private JPanel display;
  private ActionListener visualizza() {
      ActionListener evento = new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
  
              display.removeAll();
  
              Thread t = new Thread(new Runnable() {
                  public void run() {
                      JPanel visualizza = new JPanel();
                      visualizza.add(new JLabel("Test", SwingConstants.CENTER));
  
                      display.add(visualizza, BorderLayout.SOUTH);
  
                      updateProgress(visualizza);
                  }
              }
              );
  
              t.start();
          }
      };
      return evento;
  }
  
  private void updateProgress(final JPanel visualizza) {
      SwingUtilities.invokeLater(new Runnable() {
          public void run() {
              display.add(visualizza, BorderLayout.SOUTH);
          }
      });
  }}
  </code></pre>
  
  <p>I don't understand why the code don't work properly, the thread t and the thread in updateProgress work fine, but any modification to display won't affect the GUI even with invokeLater.</p>
  
  <pre><code>display.add(visualizza, BorderLayout.SOUTH)
  </code></pre>
  
  <p>This code don't modify the gui, i know it's normal (due to Swing), but why invokeLater don't work.</p>
  
  <p>Sorry for my bad english, thanks in advance for replys.</p>