public class SecondWindow extends JFrame
1:
2: import javax.swing.*;
3: import java.awt.*; //needed for the Color class
4:
5: public class SecondWindow extends JFrame
6: {
7: public static final int WIDTH = 200;
8: public static final int HEIGHT = 200;
9:
10: public SecondWindow( )
11: {
12: super( );
13:
14: setSize(WIDTH, HEIGHT);
15:
16: Container contentPane = getContentPane( );
17: JLabel label = new JLabel("Now available in color!");
18: contentPane.add(label);
19:
20: setTitle("Second Window");
21: contentPane.setBackground(Color.BLUE);
22:
23: addWindowListener(new WindowDestroyer( ));
24: }
25:
26: public SecondWindow(Color customColor)
27: {
28: super( );
29:
30: setSize(WIDTH, HEIGHT);
31:
32: Container contentPane = getContentPane( );
33: JLabel label = new JLabel("Now available in color!");
34: contentPane.add(label);
35:
36: setTitle("Second Window");
37: contentPane.setBackground(customColor);
38:
39: addWindowListener(new WindowDestroyer( ));
40: }
41: }
42:
43:
44:
45:
46: