Source of FirstWindow.java


  1: 
  2: import javax.swing.JFrame;
  3: import javax.swing.JLabel;
  4: 
  5: /**
  6:  A simple window class.
  7: */
  8: public class FirstWindow extends JFrame
  9: {
 10:     public static final int WIDTH = 300;
 11:     public static final int HEIGHT = 200;
 12: 
 13:     public FirstWindow( )
 14:     {
 15:         super( );
 16: 
 17:         setSize(WIDTH, HEIGHT);
 18:         JLabel myLabel = new JLabel("Please don't click that button!");
 19:         getContentPane( ).add(myLabel);
 20: 
 21:         WindowDestroyer listener = new WindowDestroyer( );
 22:         addWindowListener(listener);
 23:     }
 24: }