// // FILE: CloseableFrame.java // AUTHOR: Stuart Reges // DATE: 1999/08/27 // COMMENT: Class CloseableFrame is a variant of JFrame with // a window listener that closes the window and exits // the application when the user presses the close button // on the window. // // MODIFIED: none // CHANGE: none // import javax.swing.*; import java.awt.event.*; public class CloseableFrame extends JFrame { public CloseableFrame() { addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); } }