import java.awt.Frame; import java.awt.event.WindowListener; import java.awt.event.WindowEvent; class Program extends Frame implements WindowListener { Program() { addWindowListener(this); setSize(400, 300); setVisible(true); } public void windowDeactivated(WindowEvent e) { } public void windowActivated(WindowEvent e) { } public void windowDeiconified(WindowEvent e) { } public void windowIconified(WindowEvent e) { } public void windowClosed(WindowEvent e) { } public void windowClosing(WindowEvent e) { System.exit(0); } public void windowOpened(WindowEvent e) { } public static void main(String args[]) { new Program(); } }