//建立JFrame子类的内部窗体
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
class Rootwindow extends JFrame implements ActionListener
{
Container con;
Rootwindow()
{
setSize(300,300);
setVisible(true);
Container con=getContentPane();
con.setLayout(new FlowLayout());
JButton jbtn = new JButton("打开一个内部窗体");
con.add(jbtn);
        jbtn.addActionListener(this);
validate();
addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{System.exit(0);
}
});

}
public void actionPerformed(ActionEvent e) //建立内部窗体
{
JInternalFrame intf;
intf = new JInternalFrame("内部窗体",true ,true ,true ,true);
intf.setSize(150,150);
intf.setVisible(true);
con.add(intf);
JTextArea text = new JTextArea(10,20);
intf.getContentPane().add(text,BorderLayout.CENTER);
}
}
public class Example5_2
{
public static void main(String args[])
{
Rootwindow win = new Rootwindow();
win.pack();
}
}
出现一个错误,运行时,编译没问题,运行时出现一个异常,非法使用空引用~~希望各位看下,帮小弟解决这个问题,刚学java