无法弄清楚可能出现的问题?? !!应用程序构建成功并且还成功运行,但是当我尝试在JavaFX Scene Builder中加载 fxml 文件时,它未打开并出现以下错误:
com.oracle.javafx.authoring.persist.FXMLDocument$FxmlParseException: Failed to load FXML file
at com.oracle.javafx.authoring.persist.FXMLDocument.makeParseException(FXMLDocument.java:400)
at com.oracle.javafx.authoring.persist.FXMLDocument.load(FXMLDocument.java:311)
at com.oracle.javafx.authoring.persist.FXMLDocument.checkLayout(FXMLDocument.java:239)
at com.oracle.javafx.authoring.persist.FXMLDocument.checkLayout(FXMLDocument.java:224)
at com.oracle.javafx.authoring.Project.forFxml(Project.java:835)
at com.oracle.javafx.authoring.Project.forFxml(Project.java:807)
at com.oracle.javafx.authoring.DesignerTool.loadFXMLLayout(DesignerTool.java:197)
at com.oracle.javafx.authoring.DesignerTool.loadFXMLLayout(DesignerTool.java:185)
at com.oracle.javafx.authoring.DesignerTool.commonInit(DesignerTool.java:513)
at com.oracle.javafx.authoring.DesignerTool.initFromRemote(DesignerTool.java:436)
at com.oracle.javafx.authoring.mbeans.SceneBuilderMgt$1.run(SceneBuilderMgt.java:31)
at com.sun.javafx.application.PlatformImpl$4$1.run(PlatformImpl.java:179)
at com.sun.javafx.application.PlatformImpl$4$1.run(PlatformImpl.java:176)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl$4.run(PlatformImpl.java:176)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:76)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:17)
at com.sun.glass.ui.win.WinApplication$3$1.run(WinApplication.java:67)
at java.lang.Thread.run(Thread.java:724)
Caused by: javafx.fxml.LoadException: Invalid property.
at javafx.fxml.FXMLLoader$PropertyElement.<init>(FXMLLoader.java:1163)
at javafx.fxml.FXMLLoader.createElement(FXMLLoader.java:2372)
at javafx.fxml.FXMLLoader.processStartElement(FXMLLoader.java:2345)
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2164)
at com.oracle.javafx.authoring.persist.FXMLDocument$2.call(FXMLDocument.java:301)
at com.oracle.javafx.authoring.util.Utils.withFXMLDefaultClassLoader(Utils.java:2216)
at com.oracle.javafx.authoring.persist.FXMLDocument.load(FXMLDocument.java:298)
... 18 mor
我的 fxml 文件:
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.paint.*?>
<?import javafx.scene.effect.*?>
<?import javafx.scene.text.*?>
<?import java.net.*?>
<?import javafx.geometry.*?>
<?import javafx.scene.image.*?>
<?import javafx.scene.control.*?>
<?import java.lang.*?>
<?import javafx.scene.layout.*?>
<AnchorPane fx:id="root" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="640.0" prefWidth="960.0" xmlns="http://javafx.com/javafx/8.0.40" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.workspaceit.pos.view.HomeViewController">
<stylesheets>
<URL value="@themes/theme0/style.css" />
</stylesheets>
<children>
<AnchorPane fx:id="loginPane" prefHeight="598.0" prefWidth="440.0" AnchorPane.bottomAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<children>
<TextField layoutX="40.0" layoutY="278.0" prefHeight="37.0" prefWidth="358.0" text="devadmin" AnchorPane.leftAnchor="40.0" AnchorPane.rightAnchor="40.0" />
<Label layoutX="40.0" layoutY="261.0" text="User name" AnchorPane.leftAnchor="40.0" AnchorPane.rightAnchor="40.0">
<font>
<Font name="System Bold" size="12.0" />
</font></Label>
<Button defaultButton="true" layoutX="40.0" layoutY="399.0" mnemonicParsing="false" onAction="#handleLoginButtonAction" prefHeight="30.0" prefWidth="77.0" text="Login" AnchorPane.leftAnchor="40.0">
<graphic>
<ImageView fitHeight="14.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@themes/theme0/login.png" />
</image>
</ImageView>
</graphic>
</Button>
<Label layoutX="40.0" layoutY="324.0" text="Password" AnchorPane.leftAnchor="40.0" AnchorPane.rightAnchor="40.0">
<font>
<Font name="System Bold" size="12.0" />
</font></Label>
<PasswordField layoutX="40.0" layoutY="340.0" prefHeight="37.0" prefWidth="358.0" text="dev" AnchorPane.leftAnchor="40.0" AnchorPane.rightAnchor="40.0" />
<Hyperlink layoutX="40.0" layoutY="433.0" text="Forgot Password?" AnchorPane.leftAnchor="40.0" />
<ImageView fitHeight="122.0" fitWidth="172.0" layoutX="38.0" layoutY="190.0" preserveRatio="true" AnchorPane.leftAnchor="38.0" AnchorPane.topAnchor="190.0">
<viewport>
<Rectangle2D />
</viewport>
<image>
<Image url="@themes/theme0/logo.png" />
</image>
</ImageView>
</children>
</AnchorPane>
<ImageView fitHeight="122.0" fitWidth="196.0" layoutX="49.0" layoutY="460.0" preserveRatio="true" AnchorPane.bottomAnchor="40.0" AnchorPane.leftAnchor="30.0">
<viewport>
<Rectangle2D />
</viewport>
<image>
<Image url="@themes/theme0/wsit.png" />
</image>
</ImageView>
<Label layoutX="55.0" layoutY="430.0" text="Developed by" AnchorPane.bottomAnchor="65.0" AnchorPane.leftAnchor="30.0">
<font>
<Font name="System Bold" size="10.0" />
</font>
</Label>
<Hyperlink layoutX="66.0" layoutY="545.0" text="workspaceit.com" AnchorPane.bottomAnchor="30.0" AnchorPane.leftAnchor="27.0">
<font>
<Font size="10.0" />
</font>
</Hyperlink>
<MenuBar fx:id="menuBar" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<menus>
<Menu mnemonicParsing="false" text="APP">
<items>
<MenuItem mnemonicParsing="false" text="Reset Password" />
<MenuItem mnemonicParsing="false" text="Close" />
</items>
</Menu>
<Menu mnemonicParsing="false" text="HELP">
<items>
<MenuItem mnemonicParsing="false" text="About" />
<MenuItem mnemonicParsing="false" text="Check for Updates" />
</items>
</Menu>
</menus>
</MenuBar>
</children>
</AnchorPane>
有谁能建议我,我做错了什么?
答案 0 :(得分:1)
所以我通过卸载当前版本的JavaFX Scene Builder 1.1并安装了JavaFX Scene Builder 2.0来修复它。所以可能是我有一些兼容性问题。 所以this是下载链接。