我在这里有一段代码,我不确定几个命令的作用:
//this bit is the body of the main method
//lots of stuff omitted
project frame = new project();
frame.createGUI();
private void createGUI() {
setDefaultCloseOperation(EXIT_ON_CLOSE);
panel = new JPanel();
}
那么当frame.createGUI();
被调用时,中的两个命令会发生什么createGUI();
?他们是
setDefaultCloseOperation(EXIT_ON_CLOSE);
panel = new JPanel();
或者
frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
frame.panel = new JPanel();
还是完全是别的东西?我是 Java 的新手,今年开始了 12 年的计算机科学,但我有点领先于课堂。
谢谢你的时间!