// Dilip Barman November 3, 1997 // file MyFrame.java // // Define a subclass of Frame that will be able to close and // kill itself upon receiving a window close event (e.g., user // clicks on close button in window border). Otherwise, standard // frames don't go away! To use this: // // import MyFrame // ... // MyFrame myFrameInstance = new MyFrame ("Frame Title"); // ... import java.awt.*; // Window I/O classes import java.awt.event.*; // Event classes public class MyFrame extends Frame implements WindowListener { // We just have INTERFACE METHODS - WindowListener methods // We just care about closing the window public void windowActivated ( WindowEvent e ) { } public void windowDeactivated ( WindowEvent e ) { } public void windowOpened ( WindowEvent e ) { } public void windowClosed ( WindowEvent e ) { } public void windowIconified ( WindowEvent e ) { } public void windowDeiconified ( WindowEvent e ) { } public void windowClosing ( WindowEvent e ) { this.hide (); this.dispose (); } } // End MyFrame class