title: spinner image on JFrame while UI are creating
body: <p>I have an application that after successfull login (on a <code>JFrame</code>), starts to create the main frame (class <code>MainUI</code> that extends from <code>JFrame</code>). That <code>MainUI</code> class contains a <code>JTabbedPane</code> (which each tab is a class that extends from <code>JPanel</code>) and, on <code>setVisible</code> method, creates and shows each tab.</p>
  
  <p>I want to add on the login form, after successfull login, a <em>Spinner image</em> to indicate that the <code>MainUI</code> is being created.</p>
  
  <p>After display the <em>Spinner image</em>, I invoke the creation of the <code>MainUI</code> and call the <code>setVisible</code> method on <code>EventQueue.invokeLater();</code> but the <em>Spinner image</em> is not updated. If I use <code>new Thread(runner).start();</code> is updated, but I get a lot of <code>Component creation must be done on Event Dispatch Thread</code></p>
  
  <p>Some code of Login.java:</p>
  
  <pre><code>buttonLogin.addActionListener(new ActionListener() {
     public void actionPerformed(ActionEvent arg0) {
         login();
     }
  });
  
  private void login()
  {
     //check DB and permissions
     //if all is ok
     lMsj.setIcon(spinner);
     new Thread(new Runnable() {
        public void run() {
            showMainUI(usr);
        }
     }).start();
  }
  private void showMainUI(final Usuario usr)
  {
      Runnable runner = new Runnable() {
          public void run() {
              final MainUI mui = new MainUI();
              mui.setVisible(true);
  
              dispose();
          }
      };
      EventQueue.invokeLater(runner);
  }
  </code></pre>
  
  <p>and some code of MainUI.java</p>
  
  <pre><code>public MainUI()
  {
      SwingUtilities.invokeLater(new Runnable() {
          @Override public void run() {
              setMinimumSize(new Dimension(1280, 960));
  
              createComponents();
          }
      });
  }
  private void initComponents()
  {
     //..
     // menuItem = new ...
      // ...
  }
  
  @Override
  public void setVisible(boolean value)
  {
     //..
     if (Security.get().isAllowed("tab1")){
       addTab1();
     }
     //..
  }
  
  private void addTab1(){
     //..
     getTabbedPane().addTab("Tab1", new Tab1());
     //..
  }
  </code></pre>
  
  <p>How I can fix this, so that the image is updated and the user interface is created in the "background"?</p>