package newestlatestgui; import java.awt.*; import java.awt.event.*; public class NewestLatestGui extends Frame implements WindowListener { public GUIFrame(String title) { super(title); setBackground(SystemColor.control); addWindowListener(this); } public void setVisible(boolean visible) { if (visible) { Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); setLocation((d.width-getWidth())/2, (d.height-getHeight())/2); } super.setVisible(visible); } } public void windowClosing(WindowEvent p1) { dispose(); System.exit(0); } public void windowDeactivated(WindowEvent p1) {} public void windowClosed(WindowEvent p1) {} public void windowDeiconfied(WindowEvent p1) {} public void WindowOpened(WindowEvent p1) {} public void windowIconified(WindowEvent p1) {} public void windowActivated(WindowEvent p1) {} }
Why won't the window close?