英文:
Which path should I use?
问题
以下是翻译好的内容:
我有一个调用文件的类和一个运行另一个类的类,然而,我不知道应该把它放在哪里。这个文件位于 src\coutner\bldad\Runtime.java。PATH 字符串指定存储在 "pic\tricks.png":
public static final String TRICKS_PATH = "pic\\tricks.png";
以及
JLabel tricksbg = new JLabel(new ImageIcon(ImageIO.read(new File(TRICKS_PATH))));
这个文件位于 src\Main.java。现在在这里调用:
public static void main(String args[]) {
Runtime.main(concat(new String[] {""}, args));
}
我应该在 "src\coutner\bldad\pic\tricks.png" 还是 "src\pic\tricks.png" 中指定图像文件?
英文:
I have a class that calls a file and a class that runs the other, however, I don't know where I should put it. This file is in src\coutner\bldad\Runtime.java. The PATH string says to store in "pic\tricks.png":
public static final String TRICKS_PATH = "pic\\tricks.png";
and
JLabel tricksbg = new JLabel(new ImageIcon(ImageIO.read(new File(TRICKS_PATH))));
This file is in src\Main.java. Now where this calls:
public static void main(String args[]) {
Runtime.main(concat(new String[] {""}, args));
}
Should I specify the image file in "src\coutner\bldad\pic\tricks.png" or "src\pic\tricks.png"?
专注分享java语言的经验与见解,让所有开发者获益!
评论