title: How to closing the old window in java?
body: <p>When opening a new window using <strong>java GUI</strong> I want to close the old one or just redirecting the old window to the new one i tried    </p>
  
  <pre><code>setVisible(false)    
  </code></pre>
  
  <p>but it didn't work.  </p>
  
  <p>the whole ActionListener code:</p>
  
  <pre><code>public class Domainevent implements ActionListener{
  public void actionPerformed (ActionEvent event){
      GUI gg = new GUI();
      DomainGUI ee = new DomainGUI();
      gg.dispose();
      ee.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      ee.setTitle("Forbidden Domains");
      ee.setSize(700,500);
      ee.setLocation(350,100);
      ee.setResizable(false);
  }
  }
  </code></pre>