当前位置: 代码迷 >> Java相关 >> for循环的使用
  详细解决方案

for循环的使用

热度:175   发布时间:2008-11-13 01:21:38.0
for循环的使用
[bo]  1  2  3  +
  4  5  6  -
  7  8  9  *
  0  /  .  =

用FOR循环实现按钮的创建(顺序)[/bo]
搜索更多相关的解决方案: for  

----------------解决方案--------------------------------------------------------
程序代码:
    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;
    }

----------------解决方案--------------------------------------------------------
太感谢啦!!!
----------------解决方案--------------------------------------------------------
  相关解决方案