JavaFX Builder 1.0 无法打开文件

标签 java image javafx fxml

当我尝试从 Netbeans 打开 .fxml 文件时,出现以下错误:

StaffRota.fxml:101: error: 
  java.lang.IllegalArgumentException: Invalid URL or resource not found

我在该 xml 中的代码是:

<ImageView id="image1.jpg" layoutX="150.0" layoutY="18.0">
      <image>
        <Image url="/theatre/room/allocation/src/misc/image1.jpg" preserveRatio="true" smooth="true" />
      </image>
</ImageView>`

我的 java 应用程序构建和部署良好(并正确渲染图像)。为什么 JavaFX 构建器会提示?是因为图像在应用程序内吗?

如果我执行-tvf tra.jar,我会得到以下结果:-

C:\Users\..\Documents>jar -tvf tra.jar
     0 Mon Jun 17 19:54:26 BST 2013 META-INF/
   425 Mon Jun 17 19:54:26 BST 2013 META-INF/MANIFEST.MF
     0 Mon Jun 17 19:54:26 BST 2013 theatre/
     0 Mon Jun 17 19:54:26 BST 2013 theatre/room/
     0 Mon Jun 17 19:54:26 BST 2013 theatre/room/allocation/
  .. 
  2563 Mon Jun 17 19:54:26 BST 2013 theatre/room/allocation/src/misc/image1.jpg
  ..

最佳答案

通过将网址更改为@../src/misc/image1.jpg 来修复

关于JavaFX Builder 1.0 无法打开文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17136904/

相关文章:

java - Jboss 中的加载器约束冲突

java - 如何在 Java 应用程序中打印 mongodb 中的 public static final 成员?

Android - 使图像的一部分在 android 中可重复?

c# - Resource.Load 不会在 Unity 中加载最新文件

listview - 在 javafx 中删除 ListView 上的选定项目

java.net.MalformedURLException : Illegal character in URL

java - 无限跨度 : Local cache only

image - 将图像置于另一图像的黑色像素中

java - 应用程序启动时存储库不会初始化

java - 什么是 fx :controller and why do all the tutorials give me errors?