一个小程序,有错,请教
public class test extends Applet{
public void init()
{
Container cp=getContentPane();
cp.setLayout(new FlowLayout());
JButton B1=new JButton("开始");
JButton B2=new JButton("停止");
cp.add(B1);
cp.add(B2);
}
}
编译是错误如下:
D:\j2sdk1.4.0\bin>javac test.java
test.java:22: cannot resolve symbol
symbol : method getContentPane ()
location: class test
Container cp=getContentPane();
^
1 error
请问如何解决?