相对路径得到ImageIcon和Image
来源:互联网 发布:大连淘宝开店培训 编辑:程序博客网 时间:2024/05/01 03:59
public class CreateImageIcon
{
public static ImageIcon createImageIcon(String path,String description, Class klass)
{
java.net.URL imgURL = klass.getResource(path);
if (imgURL != null)
{
return new ImageIcon(imgURL, description);
}
else
{
System.err.println("Couldn't find file: " + path);
return null;
}
}
}
下面就可以得到Image
return CreateImageIcon.createImageIcon(fileName, "", ImageTest.class).getImage();
- 相对路径得到ImageIcon和Image
- ImageIcon icon 相对路径设置
- ImageIcon的相对路径设置
- ImageIcon图标文件相对路径研究总结
- ImageIcon图标文件相对路径研究总结
- ImageIcon & Image
- ImageIcon和Image之间的相互作用
- Image、BufferImage和ImageIcon关系及用法
- Image BufferImage 和 ImageIcon的区别
- Image、BufferImage和ImageIcon关系及用法
- 【Java基础 008】 ImageIcon 图标相对路径解析
- 关于image中的imageUrl相对路径和绝对路径
- 得到.Jar的相对路径
- SWT 相对路径创建Image
- Java - Image VS ImageIcon
- Icon, ImageIcon & image
- JAVA图形类问题:ImageIcon和Image类区别
- Java关于Image和ImageIcon的小阴谋
- 7章7节使用swich控制语句
- 看儿子的视频
- 读林斌博士写好代码十个秘诀
- 网站里面没有搜索功能的解决办法(还有些搜索技巧)
- 用C#实现生成PDF文档
- 相对路径得到ImageIcon和Image
- 纪念日
- flex video
- 【转帖】map,set,list,等JAVA中集合解析 - Java - cjw的资料
- Eclipse Process Framework: a new tool for porject process management
- 用面向对象编程打印菱形
- 终于开始使用博客了
- unittest++?还是用cppunit吧
- 祭马诔----纪念“嗷嗷叫的老马”不写程序的日子