for循环的使用
[bo] 1 2 3 +4 5 6 -
7 8 9 *
0 / . =
用FOR循环实现按钮的创建(顺序)[/bo]
public JButton[] createButtons(){ String[] label = {"1","2","3","+","4","5","6","-","7","8","9","*","0","/",".","="}; JButton[] buttons = new JButton[16]; for(int i=0;i<label.length;i++){ buttons[i] = new JButton(label[i]); } return buttons; }