声明JButton数组:
JButton[] a = new JButto[2];
private void jbInit() throws Exception {
......
......
a[0].setText("hehe");
a[0].setBounds(new Rectangle(92, 65, 20, 20));
a[1].setText("haha");
a[1].setBounds(new Rectangle(98, 61, 20, 20)); this.getContentPane().add(a[0]);
this.getContentPane().add(a[1]);
...... ......
}大家看看对吗?我这样写的
但是,在面板却加不上这两个按钮?
谁知道,如何才能把数组JButton加
到面板上?
另外都加好后需要setVisible(true)
JButto[2];
a[0]=new JButton();
a[1]=new JButton();
这两句有么?