home *** CD-ROM | disk | FTP | other *** search
/ The Net: Ultimate Internet Guide / WWLCD1.ISO / pc / java / enxle1f6 / src / win / closableframe / closableframe.java
Encoding:
Java Source  |  1996-08-14  |  561 b   |  32 lines

  1. /*
  2.  * @(#)ClosableFrame.java
  3.  */
  4. package win.ClosableFrame;
  5.  
  6. import java.awt.*;
  7.  
  8. /**
  9.  * A simple frame that exits the applet viewer if you close it.
  10.  */
  11.  
  12. public class ClosableFrame extends Frame {
  13.     /**
  14.      * construct the frame
  15.      * @param title the title for the title bar
  16.      */
  17.     public ClosableFrame(String title) {
  18.         super(title);
  19.     }
  20.  
  21.     /**
  22.      * override handleEvent() so that the system exits.
  23.      */
  24.     public boolean handleEvent(Event e) {
  25.         if (e.id == Event.WINDOW_DESTROY) {
  26.             System.exit(0);
  27.         }
  28.         return super.handleEvent(e);
  29.     }
  30.  
  31. }
  32.