标题:for循环的使用
只看楼主
598156412
Rank: 1
等 级:新手上路
帖 子:43
专家分:0
注 册:2007-12-16
 问题点数:0 回复次数:2 
for循环的使用
[bo]  1  2  3  +
  4  5  6  -
  7  8  9  *
  0  /  .  =

用FOR循环实现按钮的创建(顺序)[/bo]
搜索更多相关主题的帖子: for 
2008-11-13 01:21
freish
Rank: 6Rank: 6
等 级:贵宾
威 望:23
帖 子:1223
专家分:437
注 册:2007-6-1
得分:0 
程序代码:
    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;
    }
2008-11-13 10:04
598156412
Rank: 1
等 级:新手上路
帖 子:43
专家分:0
注 册:2007-12-16
得分:0 
太感谢啦!!!
2008-11-14 17:41



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-243939-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.243922 second(s), 7 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved