Topic: [j2ee]关于在计算器上放置按纽的问题 |
Print this page |
1.[j2ee]关于在计算器上放置按纽的问题 | Copy to clipboard |
Posted by: zliwei Posted on: 2003-04-15 22:16 我想做一个计算器,在放置按纽时,我想通过一个数组来设置按纽。 于是我这样写: private Button []b; private Panel pcontainer; setLayout(new GridLayout(3,3)); for(int i = 1; i<=9; i++) { b[i] = new Button; pcontainer.add(b[i]); } 可是,编译器提示Button()中只能放置字符串,于是我设置: b[i] = new Button(toString ); 但编译器还是不通过: cannot resolve symbol symbol : method toString (int) 难道只能手工一个一个放置按纽么??? 请大家帮忙!!! |
2.Re:[j2ee]关于在计算器上放置按纽的问题 [Re: zliwei] | Copy to clipboard |
Posted by: jimshen Posted on: 2003-04-16 07:30 你这个toString是哪个类的成员方法?如果要放0~9,直接这样用就可以了 b[i] = new Button(""+i); |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |