title: Swing: clean transition between two JFrames
body: <p>A while ago, I read that the best way to switch between different "screens" in an application would be to set up different <code>JFrame</code>s and then simply dipose the first and call the second. For example I have Screen A extending <code>JFrame</code> and Screen B extending <code>JFrame</code>, on a button that should switch to the next screen I would write something like that</p>
  
  <pre><code>JButton button = new JButton("show next screen");
  button.addActionListener(){
      new ScreenB();
      frameA.dispose(); // assumed that we coded something like frameA = this earlier
  }
  </code></pre>
  
  <p>Now the problem is that between the changeover of the two frames, I see for let's say 1/10 either Screen A or Screen B, which is very ugly. What would be a better solution? Extending the screens as <code>Container</code> and set them as <code>ContentPane</code> for the always the same <code>JFrame</code>? </p>