![[填空题] 阅读下面代码:import java.awt.*;public class Exam11,第1张 [填空题] 阅读下面代码:import java.awt.*;public class Exam11,第1张](/aiimages/%5B%E5%A1%AB%E7%A9%BA%E9%A2%98%5D+%E9%98%85%E8%AF%BB%E4%B8%8B%E9%9D%A2%E4%BB%A3%E7%A0%81%EF%BC%9Aimport+java.awt.%2A%3Bpublic+class+Exam11.png)
[填空题] 阅读下面代码:
import java.awt.*;
public class Exam11_1
private frame f;
private Button b1,b2,b3,b4;
public static void main(String args[]
Exam11_1 that = new Exam11 1 ();that.go();
public void go()______;f.setLayout(new FlowLayout()) ;;
b1 = new Button ("Button 1");
b2 = new Button ("Button 2");
b3 = new Button ("Button 3");
b4 = new Button ("Button 4");
f.add (b1);
f.add (b2);
f.add (b3);
f.add (b4);
f.pack ();
f.setVisible (true);
请在程序中画线处填写正确的语句 【13】 ,以便编译运行程序后得到正确的结果。
正确答案:f=new frame("GUI example")
参考解析:本题考查容器和布局管理器的基本知识,属于综合题。在本程序里,缺少建立frame的语句,而且该frame的名字为GUI example,而4个按钮的布局方式被压缩至最小,因此是 FlowLayou布局方式。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)