| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 990 人关注过本帖
标题:JButton 图像按钮不能正常显示!
只看楼主 加入收藏
ren829
Rank: 9Rank: 9Rank: 9
等 级:贵宾
威 望:15
帖 子:255
专家分:1174
注 册:2006-3-11
结帖率:100%
收藏
 问题点数:0 回复次数:1 
JButton 图像按钮不能正常显示!

import javax.swing.*;
import java.awt.*;

class ShowJButton extends JFrame
{
JButton jb1=new JButton ("up");
ImageIcon im1 =new ImageIcon("D:\\图片\\105");
JButton jb2=new JButton("down",im1);
ImageIcon im2=new ImageIcon("D:\\图片\\100");
JButton jb3 =new JButton(im2);
FlowLayout fl =new FlowLayout();

ShowJButton()
{
super("testing...");
setSize(200,150);

setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
jb3.setToolTipText("out");
this.getContentPane().setLayout(fl);
this.getContentPane().add(jb1);
this.getContentPane().add(jb2);
this.getContentPane().add(jb3);
show();
}

public static void main(String[]args)
{
ShowJButton sjb=new ShowJButton();
}
}

按钮上图象都不能显示,求助!

搜索更多相关主题的帖子: JButton 图像 按钮 
2006-08-13 17:53
afeifly
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2006-8-13
收藏
得分:0 
怎么能用绝对路径呢?做一个包放图片 比如:
Icon I1 = new ImageIcon("com/StockMarket/GUI/Image/history.gif");
2006-08-13 20:29
快速回复:JButton 图像按钮不能正常显示!
数据加载中...
 
   



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

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