有人可以告诉我为什么这不运行?我已经从我的介绍中直接复制了java书。在运行它时应该返回一个显示六位数字的窗口。从java书直接复制的代码不想运行
import java.awt.*;
import javax.swing.*;
public class TestFigurePanel extends JFrame {
public TestFigurePanel() {
setLayout(new GridLayout(2, 3, 5, 5));
add(new FigurePanel(FigurePanel.LINE));
add(new FigurePanel(FigurePanel.RECTANGLE));
add(new FigurePanel(FigurePanel.ROUND_RECTANGLE));
add(new FigurePanel(FigurePanel.OVAL));
add(new FigurePanel(FigurePanel.RECTANGLE, true));
add(new FigurePanel(FigurePanel.ROUND_RECTANGLE, true));
}
public static void main(String[] args) {
TestFigurePanel frame = new TestFigurePanel();
frame.setSize(400, 200);
frame.setTitle("TestFigurePanel");
frame.setLocationRelativeTo(null); // Center the frame
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
}
,特别是? – 2014-11-05 18:21:14
异常在线程“主要” java.lang.Error的:未解决编译问题: \t在类型容器的制造方法中添加(成分)是不适用 \t FigurePanel不能解析为一个类型 \t FigurePanel参数(FigurePanel)无法解析为变量 – 2014-11-05 18:21:49
那么,什么*是一个'图形面板'?快速搜索表明它来自纽约市的一些简介编程课程。 – Makoto 2014-11-05 18:22:46