import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
public class Jsq extends JFrame
{
JPanel pl1=new JPanel();
JPanel pl2=new JPanel();
JTextField tf=new JTextField("0",10);
JButton bt=new JButton("清空");
JButton bt[]=new JButton[16];
String str[]={"1","2","3","+","4","5","6","-","7","8","9","*","0",".","/","="};
public Jsq()
{
super("计算器");
Container c=getContentPane();
c.add(pl1,BorderLayout.NORTH);
c.add(pl2,BorderLayout.CENTER);
pl1.setLayout(new FlowLayout());
pl1.add(tf);
pl1.add(bt);
pl2.setLayout(new GridLayout(4,4));
for(int i=0;i<16;i++)
{
bt[i]=new JButton(str[i]);
pl2.add(bt[i]);
}
setSize(200,200);
setVisible(true);
setResizable(false);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public static void main(String args[])
{
new Jsq();
}
}
为什么在编译时会出现
--------------------Configuration: <Default>--------------------
F:\java\xm\Jsq.java:10: 已在 Jsq 中定义 bt
JButton bt[]=new JButton[16];
^
F:\java\xm\Jsq.java:27: 需要数组,但找到 javax.swing.JButton
bt[i]=new JButton(str[i]);
^
F:\java\xm\Jsq.java:28: 需要数组,但找到 javax.swing.JButton
pl2.add(bt[i]);
^
3 错误
Process completed.
的错误呢