/**Jdk 1.0 version*/ import java.awt.*; /*jdk 1.0 - version public class GoodFrame extends Frame { public GoodFrame() {super();} public GoodFrame(String title) {super(title);} public boolean handleEvent(Event e) { if (e.id == Event.WINDOW_DESTROY) { //get all components Component c[] = getComponents(); //each component handles e for (int i = 0; i < c.length; i++) c[i].handleEvent(e); //destroy current GoodFrame dispose(); return false; } //handle all other events in default way return super.handleEvent(e); } } */ /*jd1 1.1 - version*/ import java.awt.event.*; public class GoodFrame extends Frame { public GoodFrame() { addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) {System.exit(0);} }); } }