[英]How to reference a file from a package - JavaFXPorts
Please take a look to the image for code reference: 请看一下图片以获取代码参考:
If you run the code above, TextArea
displays File Exists: false
. 如果运行上面的代码,则
TextArea
显示File Exists: false
。
Take Note: This code works: ImageView image = new ImageView(new Image("icon/setting.png"));
请注意:此代码有效:
ImageView image = new ImageView(new Image("icon/setting.png"));
. 。 This means the system found the file icon/setting.png but not file/reportdata.txt .
这意味着系统找到了文件icon / setting.png,但是没有找到file / reportdata.txt 。
Why? 为什么? How to reference it?
怎么引用呢?
That's because the meaning of the string argument of File and Image is different. 这是因为File和Image的字符串参数的含义不同。 Please read the documentation exactly.
请准确阅读文档。
PS: Don't post screen shots here. PS:不要在这里发布屏幕截图。 Provide a real code example.
提供一个真实的代码示例。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.