I have a main JFrame which has other JFrames embedded to it which opens up on clicking the buttons on the main JFrame. The embedded JFrame has the following codes to close:
 public void windowClosing(WindowEvent we)
{
System.exit(0);
}
but the problem is once i close the embedded JFrame the main JFrame also closes with it. I want only the embedded JFrame to close. can anyone help me out with this? Secondly, is
   this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
or
   public void windowClosing(WindowEvent we)
  {
    System.exit(0);
  }
better to close a frame?
 
    