title: Second JFrame closes first
body: <p>two <code>JFrame</code>s,</p>
  
  <p><code>JFrame Main; // Main JFrame</code></p>
  
  <p><code>JFrame Sub; //Second JFrame that is initialized from within Main via a JMenuItems ActionListener.</code></p>
  
  <pre><code>mainMenuItem.setActionListener(new ActionListener(){
      public void actionPerformed(ActionEvent arg0) {
          try{
              Sub subFrame = new Sub();
              subFrame.setVisible(true);
          }catch(Exception e){}
          }
      });
  }
  </code></pre>
  
  <p>The problem is whenever i close the second JFrame (Sub) it closes the first aswell.</p>
  
  <p>Both <code>JFrame</code>s have:</p>
  
  <pre><code>setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  </code></pre>
  
  <p>Is that part of the problem?</p>