Source of WindowDestroyer.java


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