简答题:本题的功能是用流式布局管理器来管理窗口中的按钮。在执行程序时指定生成按钮的个数,并把这些按钮都放置在流式布局管理器的窗口

  • 题目分类:Java
  • 题目类型:简答题
  • 查看权限:VIP
题目内容:
本题的功能是用流式布局管理器来管理窗口中的按钮。在执行程序时指定生成按钮的个数,并把这些按钮都放置在流式布局管理器的窗口中。
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[O];
int buttonNumber=
ButtonFrame frame=new ButtonFrame(button-
Number);
frame.setDefaultCloseOperation(JFrame.EXIT_
ON_CLoSE);
frame.show();
}
}
class ButtonFrame extends JFrame
{
public ButtonFrame( )
{
buttons=buttonNumber:
setTitle("java2");
setSize(WIDTH,HEIGHT);
JPanel buttonPanel=new 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;
}
参考答案:
答案解析:

How old are the people whorun the restaurant7.

How old are the people whorun the restaurant7. A.Over 20. B.Frbm 16 to 21. C.Fro

查看答案

________________

________________

查看答案

根据下列试题,填写词语:Generations of Americans have been brought ____

根据下列试题,填写词语:Generations of Americans have been brought ____ 26 ____ to believe

查看答案

What does the telegram say?

What does the telegram say?A.Return immediately for his parents missed him badly

查看答案

一Will you go to the Great Wall with us?一If John wants to go,

一Will you go to the Great Wall with us?一If John wants to go,________. A.so will

查看答案