Z:\Faculty\cindricbb\000work\CSC120\Java\lec18_s23\src\MUPanel.java
 1 
 2 import java.awt.*;
 3 import javax.swing.*;
 4 
 5 public class MUPanel extends JPanel {
 6 
 7     // 1. Declare private objects here:
 8     
 9     
10 
11     // constructor method
12     public MUPanel() {
13         setLayout(null);
14         setPreferredSize(new Dimension(800, 300));
15         setName("Mount Union Java Program");
16         setUp();
17         setBackground(Color.WHITE);
18 
19         // 2. Instantiate objects here by calling "new":
20         
21 
22         
23     } // end of constructor
24     
25     @Override
26     public void paintComponent(Graphics g) {
27         super.paintComponent(g); // This line must be first in this method!
28 
29         // 3. Call methods of objects here:
30 
31         g.setFont( new Font("SansSerif", Font.PLAIN, 24));
32         g.drawString("Look in Java Console for answers", 50, 160);
33                 
34                 
35     } // end of paintComponent()
36     
37     
38     
39        
40     
41     
42     
43     /***********************************************
44      * Do NOT change or delete anything below here!
45      ***********************************************/
46     public void setUp() {
47         for (Component c: getComponents())
48             c.setSize(c.getPreferredSize());
49         JFrame f = new JFrame(getName());
50         f.setContentPane(this);
51         f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
52         f.pack();
53         f.setVisible(false);    
54     }
55 
56     public static void main(String args[]){new MUPanel();}
57 
58 } // end of class MUPanel
59