在 fxml 中找不到 Javafx 图像
Javafx image is not found in fxml
我已经搜索了很多可能的问题和答案,但我找不到任何解决方案。
我有我的 fxml 作为,
<Menu mnemonicParsing="false" text="Profile">
<items>
<MenuItem id="loadProfile" mnemonicParsing="false" text="Load Profile" style="-fx-graphic: url('../res/icon_open_32x32.png');" />
</items>
</Menu>
我的项目结构是:
com.vion.myapp.view
- Application.fxml
com.vion.myapp.res
- icon_open_32x32.png
为什么我的菜单项找不到图像并显示它?
谢谢
使用资源的绝对路径:/com/vion/myapp/res/icon_open_32x32.png
。
似乎 ../res/icon_open_32x32.png
当前路径未定义或不等于 /com/vion/myapp/view
。
我已经搜索了很多可能的问题和答案,但我找不到任何解决方案。 我有我的 fxml 作为,
<Menu mnemonicParsing="false" text="Profile">
<items>
<MenuItem id="loadProfile" mnemonicParsing="false" text="Load Profile" style="-fx-graphic: url('../res/icon_open_32x32.png');" />
</items>
</Menu>
我的项目结构是:
com.vion.myapp.view
- Application.fxml
com.vion.myapp.res
- icon_open_32x32.png
为什么我的菜单项找不到图像并显示它?
谢谢
使用资源的绝对路径:/com/vion/myapp/res/icon_open_32x32.png
。
似乎 ../res/icon_open_32x32.png
当前路径未定义或不等于 /com/vion/myapp/view
。