从无法在Windows上运行的资源加载图像
|
为什么在Windows上却不能在Mac上运行呢?
public final static String PATH = \"resources\" + File.separator;
/** Returns an ImageIcon, or null if the path was invalid. */
public static ImageIcon createImageIcon(String name, String description) {
java.net.URL imgURL = GuiTools.class.getResource(PATH + name);
if (imgURL != null) {
return new ImageIcon(imgURL, description);
} else {
System.err.println(\"Couldn\'t find file: \" + PATH + name);
return null;
}
}
没有找到相关结果
已邀请:
1 个回复
细屠截殴些