标题:这个程序错在哪?
取消只看楼主
nsqq
Rank: 1
等 级:新手上路
帖 子:71
专家分:0
注 册:2007-7-4
 问题点数:0 回复次数:2 
这个程序错在哪?
import javax.swing.*;
public class ImageIcons extends JFrame{
JButton [] buttons= new JButton[10];
public ImageIcons(){
super("imageicons");
setSize(350,200);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel pane= new JPanel();
ImageIcon icon= new ImageIcon("face.gif");
for(int i=0;i<10;i++){
buttons[i]= new JButton(icon);
pane.add(buttons[i]);
}
setContentPane(pane);
show();
}
public static void main(String [] args){
ImageIcons inic = new ImageIcons();
}
}
为啥显示不出十个图形,笑脸
搜索更多相关主题的帖子: class public import 
2007-09-13 13:17
nsqq
Rank: 1
等 级:新手上路
帖 子:71
专家分:0
注 册:2007-7-4
得分:0 
2007-09-13 14:45
nsqq
Rank: 1
等 级:新手上路
帖 子:71
专家分:0
注 册:2007-7-4
得分:0 

是不是把buttons[i]= new JButton(icon);该行改为buttion[i].seticon(new ImageIcon(this.getClass().getResource(face.gif)));
怎么还出错呀

2007-09-13 19:01



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




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

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