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