比如我新建一个工程CoreJava。其中有CoreJava/bin,CoreJava/src两个文件夹。
如果图像文件放在CoreJava文件夹内,则书写格式为:
new ImageIcon("yellow-ball.gif");
如果放在CoreJava/src文件夹内,则书写格式为:
new ImageIcon("src/yellow-ball.gif");
比如我新建一个工程CoreJava。其中有CoreJava/bin,CoreJava/src两个文件夹。
如果图像文件放在CoreJava文件夹内,则书写格式为:
new ImageIcon("yellow-ball.gif");
如果放在CoreJava/src文件夹内,则书写格式为:
new ImageIcon("src/yellow-ball.gif");