title: Swing: setContentPane not refreshing the interface when called
body: <p>I'm having a problem with my applet: it doesn't refresh when I need it to.</p>
  
  <p>I'm trying to switch from one interface screen to the other when I click on the button.</p>
  
  <p>I have a </p>
  
  <pre><code>public class PixelRainEditorApp extends JApplet
  </code></pre>
  
  <p>and in the init </p>
  
  <pre><code>SwingUtilities.invokeAndWait(new Runnable() {
      public void run() {
          createGUI();
      }
  });
  private void createGUI() {
      a = new A(this);
      this.setSize(800, 480);
  }
  </code></pre>
  
  <p>Then I have 2 classes A and B that extend JPanel</p>
  
  <pre><code>public A(JApplet parent) {
     super(parent);
     setOpaque(true);
     setBackground(Color.BLACK);
     this.parent.setContentPane(this);
  }
  </code></pre>
  
  <p>when I click on a button in view A</p>
  
  <pre><code>@Override
  public void actionPerformed(ActionEvent e) {
     if(TAG.equalsIgnoreCase(e.getActionCommand())){
        new B(this.baseParent);
     }
  }
  </code></pre>
  
  <p>and B is the same as A but with different images</p>
  
  <pre><code>public B(JApplet parent) {
         super(parent);
         setOpaque(true);
         setBackground(Color.BLACK);
         this.parent.setContentPane(this);
      }
  </code></pre>
  
  <p>Now this works fine when I want to display A, but when I want to launch B when I click on a button in A, nothing happens.
  Its only when I resize the window that B appears...
  I tried to invalidate or repaint and various places in my applications but nothing happens</p>
  
  <p>Any ideas ? </p>
  
  <p>Jason</p>