title: Need to close a parent window only if the child window get closed in java swing
body: <p>I have two radio buttons in frame1. On click on enable radio button, it will popup another frame called frame2. I want, not to close the frame1 while the frame2 is opened. But it get closed when click on the X. I used "frame1.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);". Still it get closed. </p>
  
  <pre><code>enable.addItemListener(new ItemListener() 
  {
    @Override
    public void itemStateChanged(ItemEvent e) 
     {
       // TODO Auto-generated method stub                     
      frame2.setVisible(true);
      frame1.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
      }
  </code></pre>