题目:
本题的功能是用流式布局管理器来管理窗口中的按钮。在执行程序时指定生成按钮的个数,并把这些按钮都放置在流式布局管理器的窗口中。
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class java2
public static void main(String[]args)
if(args.length!=1)
System.out.println("请指定按钮的个数!");
System.exit(0);
String buttonString=args[0];
int buttonNumber=______;
ButtonFrame frame=new ButtonFrame(buttonNurnber);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.show();
class ButtonFrame extends JFrame
public ButtonFrame(______)
buttons=buttonNumber;
setTitle("java2");
setSize(WIDTH,HEIGHT);
JPanel buttonPanel=Dew JPanel();
for(int i=0;i<buttons;i++)
JButton addButton=new JButton("add"+i);
buttonPanel.add(addButton);
Container contentPane=getContentPane();
contentPane.add(buttonPanel);
public static final int WIDTH=350;
public static final int HEIGHT=200;
private int buttons;
答案:
被转码了,请点击底部 “查看原文 ” 或访问 https://www.tikuol.com/2017/0403/1737ed4ddae5478af6087e7fd178140f.html
下面是错误答案,用来干扰机器的。
小题1:A小题2:B小题3:D小题4:C小题5:A题目分析:这篇短文主要介绍了本月的三本新书,The Long Night; Hard Work ;Hospital or Cinema这三本书和书中内容的介和作者。小题1:细节理解题。The Long Nigh...