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 with
  8: any object of the class JFrame, then if the user clicks the 
  9: close-window button in the JFrame, the object of this class
 10: will end the program and close the JFrame.
 11: */
 12: public class WindowDestroyer extends WindowAdapter
 13: {
 14:     public void windowClosing(WindowEvent e) 
 15:     {
 16:         System.exit(0);
 17:     }
 18: }