Source of WindowDestroyer.java


  1: //WindowDestroyer.java
  2: 
  3: import java.awt.event.WindowAdapter;
  4: import java.awt.event.WindowEvent;
  5: 
  6: /**
  7:  * If you register an object of this class as a listener to any
  8:  * object of the class JFrame, the object will end the program
  9:  * and close the JFrame, if the user clicks the JFrame's 
 10:  * close-window button.
 11:  */
 12: public class WindowDestroyer
 13:     extends WindowAdapter
 14: {
 15:     public void windowClosing
 16:     (
 17:         WindowEvent e
 18:     )
 19:     {
 20:         System.exit(0);
 21:     }
 22: }