360win10模块安装失败:请问这个程序错在哪?(JAVA)

来源:百度文库 编辑:神马品牌网 时间:2024/05/03 06:20:13
import java.awt.*;
public class exec
{
public static void main(String args[])
{
Frame f=new Frame("This is a window!");
f.setLocation(100,200);
f.setSize(200,400);
f.setBackground(Color.red);

FlowLayout fl=new FlowLayout();
f.setLayout(fl);

Button[] barray=new Button[10];
for(int i=0;i<barray.length;i++)
{
barray=new Button();
barray.setLabel(String.valueOf(i));
f.add(barray);
}

f.setVisible(true);
}
}

import java.awt.*;
public class exec
{

public static void main(String args[])
{
Frame f=new Frame("This is a window!");
f.setLocation(100,200);
f.setSize(200,400);
f.setBackground(Color.red);

FlowLayout fl=new FlowLayout();
f.setLayout(fl);

Button barray;
for(int i=0;i<10;i++)
{
barray=new Button();
barray.setLabel(String.valueOf(i));
f.add(barray);
}

f.setVisible(true);
}
}

检查一下第二个大括号..

缺少监听器.