有程序如下:
import java.awt.BorderLayout;
import java.awt.GridLayout;
import java.sql.*;
import javax.swing.*;
import javax.swing.JLabel;
import javax.swing.JPanel;public class Exercise37_1 extends JFrame{ /**
 * @param args
 */

// Variables declaration
Connection dbConnection;

private JLabel titleLabel;//to display "course information"

private JLabel courseIDLabel;
private JLabel subjectIDLabel;
private JLabel courseNumberLabel;
private JLabel courseTitleLabel;
private JLabel creditsLabel;
         
         public Exercise37_1()
{
//add and organize components
JPanel panel1 = new JPanel(new GridLayout(5,0));
panel1.add(courseIDLabel);
panel1.add(subjectIDLabel);
panel1.add(courseNumberLabel);
panel1.add(courseTitleLabel);
panel1.add(creditsLabel);
         
                  setTitle("Exercise37_1");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
pack();
setVisible(true);


}
public static void main(String[] args) {
// TODO Auto-generated method stub
new Exercise37_1(); }}
编译时报错:
Exception in thread "main" java.lang.NullPointerException
at java.awt.Container.addImpl(Unknown Source)
at java.awt.Container.add(Unknown Source)
at Exercise37_1.<init>(Exercise37_1.java:43)
at Exercise37_1.main(Exercise37_1.java:72)第43行也就是
         panel1.add(courseIDLabel);
这行出错,说是“source not found”,可是courseIDLabel已经定义了是JLabel,请问问题出在哪里