虽然没有错误,但Scene Builder无法加载我的fxml文件

时间:2016-05-02 18:00:36

标签: javafx fxml scenebuilder

从Java代码加载fxml时没有错误。 我浏览了以前的帖子并尝试了提到的解决方案,但还没有找到修复程序。 到目前为止,我的fxml工作正常。 但我调整了一些东西,并且Scene Builder没有给出任何错误,但是当我在Scene Builder中预览它时它不会渲染我的fxml文件,而我看到的只是一个空白的白色屏幕。

以下是fxml文件的代码:

<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.geometry.Insets?>
<?import javafx.scene.Cursor?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.PasswordField?>
<?import javafx.scene.control.TextArea?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.control.Tooltip?>
<?import javafx.scene.effect.Blend?>
<?import javafx.scene.effect.Bloom?>
<?import javafx.scene.effect.ColorAdjust?>
<?import javafx.scene.effect.DropShadow?>
<?import javafx.scene.effect.Glow?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.BorderPane?>
<?import javafx.scene.layout.Pane?>
<?import javafx.scene.text.Font?>

<AnchorPane id="customerAnchorPane" fx:id="customerAnchorPane" blendMode="OVERLAY" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" style="-fx-background-color: gray; -fx-border-color: gray;" xmlns="http://javafx.com/javafx/8.0.65" xmlns:fx="http://javafx.com/fxml/1">
   <children>
      <BorderPane id="login" fx:id="login" layoutX="2.0" layoutY="2.0" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="398.0" prefWidth="600.0" style="-fx-background-color: gray;" AnchorPane.bottomAnchor="1.0" AnchorPane.leftAnchor="1.0" AnchorPane.rightAnchor="-1.0" AnchorPane.topAnchor="1.0">
         <left>
            <Pane id="customerLabels_pane" fx:id="customerLabels_pane" prefHeight="299.0" prefWidth="200.0" BorderPane.alignment="CENTER">
               <children>
                  <Label id="customerfName_label" fx:id="customerfName_label" alignment="CENTER" contentDisplay="CENTER" layoutX="46.0" layoutY="101.0" prefHeight="35.0" prefWidth="109.0" style="-fx-background-color: wheat; -fx-border-color: brown;" text="First Name" textFill="#081057">
                     <font>
                        <Font name="Wawati SC Regular" size="16.0" />
                     </font>
                     <padding>
                        <Insets bottom="5.0" left="15.0" right="8.0" top="5.0" />
                     </padding>
                  </Label>
                  <Label id="customerlName_label" fx:id="customerlName_label" alignment="CENTER" contentDisplay="CENTER" layoutX="46.0" layoutY="147.0" prefHeight="35.0" prefWidth="109.0" style="-fx-background-color: wheat; -fx-border-color: brown;" text="Last Name" textAlignment="CENTER" textFill="#081057">
                     <font>
                        <Font name="Wawati SC Regular" size="16.0" />
                     </font>
                     <padding>
                        <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
                     </padding>
                  </Label>
                  <Label id="customerEmail_label1" fx:id="customerEmail_label1" alignment="CENTER" contentDisplay="CENTER" layoutX="46.0" layoutY="189.0" prefHeight="35.0" prefWidth="109.0" style="-fx-background-color: wheat; -fx-border-color: brown;" text="Email" textAlignment="CENTER" textFill="#081057">
                     <font>
                        <Font name="Wawati SC Regular" size="16.0" />
                     </font>
                     <padding>
                        <Insets bottom="5.0" left="15.0" right="8.0" top="5.0" />
                     </padding>
                  </Label>
                  <Label id="customerAddress_label" fx:id="customerAddress_label" alignment="CENTER" contentDisplay="CENTER" layoutX="46.0" layoutY="238.0" prefHeight="35.0" prefWidth="109.0" style="-fx-background-color: wheat; -fx-border-color: brown;" text="Address" textAlignment="CENTER" textFill="#081057">
                     <font>
                        <Font name="Wawati SC Regular" size="16.0" />
                     </font>
                     <padding>
                        <Insets bottom="5.0" left="15.0" right="8.0" top="5.0" />
                     </padding>
                  </Label>
                  <Label id="customerUsername_label" fx:id="customerUsername_label" alignment="CENTER" contentDisplay="CENTER" layoutX="46.0" layoutY="14.0" prefHeight="35.0" prefWidth="109.0" style="-fx-background-color: wheat; -fx-border-color: brown;" text="Username" textFill="#081057">
                     <font>
                        <Font name="Wawati SC Regular" size="16.0" />
                     </font>
                     <padding>
                        <Insets bottom="5.0" left="15.0" right="8.0" top="5.0" />
                     </padding>
                  </Label>
                  <Label id="customerPassword_label" fx:id="customerPassword_label" alignment="CENTER" contentDisplay="CENTER" layoutX="46.0" layoutY="56.0" prefHeight="35.0" prefWidth="109.0" style="-fx-background-color: wheat; -fx-border-color: brown;" text="Password" textFill="#081057">
                     <font>
                        <Font name="Wawati SC Regular" size="16.0" />
                     </font>
                     <padding>
                        <Insets bottom="5.0" left="15.0" right="8.0" top="5.0" />
                     </padding>
                  </Label>
               </children>
            </Pane>
         </left>
         <center>
            <Pane id="signUptFields_pane" fx:id="signUptFields_pane" prefHeight="308.0" prefWidth="397.0" BorderPane.alignment="CENTER">
               <children>
                  <TextField id="customerUsername_tField" fx:id="customerUsername_tField" alignment="CENTER" layoutX="14.0" layoutY="14.0" prefHeight="35.0" prefWidth="230.0" promptText="Enter username here" style="-fx-background-color: gray;">
                     <padding>
                        <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
                     </padding>
                     <font>
                        <Font name="Courier Oblique" size="14.0" />
                     </font>
                     <effect>
                        <Glow />
                     </effect>
                     <tooltip>
                        <Tooltip id="usernameToolTip" fx:id="usernameToolTip" autoHide="true" contentDisplay="CENTER" text="Do not enter special characters or spaces" textAlignment="CENTER">
                           <font>
                              <Font name="Wawati SC Regular" size="13.0" />
                           </font>
                        </Tooltip>
                     </tooltip>
                  </TextField>
                  <PasswordField id="customerPassword_tField" fx:id="customerPassword_tField" alignment="CENTER" layoutX="14.0" layoutY="59.0" prefHeight="35.0" prefWidth="230.0" promptText="Enter password here" style="-fx-background-color: gray;">
                     <padding>
                        <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
                     </padding>
                     <font>
                        <Font name="Courier Oblique" size="14.0" />
                     </font>
                     <effect>
                        <Glow />
                     </effect>
                  </PasswordField>
                  <TextField id="customerfName_tField" fx:id="customerfName_tField" alignment="CENTER" layoutX="14.0" layoutY="102.0" prefHeight="35.0" prefWidth="230.0" promptText="Enter first name here" style="-fx-background-color: gray;">
                     <padding>
                        <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
                     </padding>
                     <font>
                        <Font name="Courier Oblique" size="14.0" />
                     </font>
                     <effect>
                        <Glow />
                     </effect>
                     <tooltip>
                        <Tooltip id="fNameToolTip" fx:id="fNameToolTip" contentDisplay="CENTER" text="Enter only characters, no spaces allowed" textAlignment="CENTER">
                           <font>
                              <Font name="Wawati SC Regular" size="13.0" />
                           </font>
                        </Tooltip>
                     </tooltip>
                  </TextField>
                  <TextField id="customerlName_tField" fx:id="customerlName_tField" accessibleRole="TEXT_FIELD" alignment="CENTER" layoutX="14.0" layoutY="146.0" prefHeight="35.0" prefWidth="230.0" promptText="Enter last name here" style="-fx-background-color: gray;">
                     <padding>
                        <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
                     </padding>
                     <font>
                        <Font name="Courier Oblique" size="14.0" />
                     </font>
                     <effect>
                        <Glow />
                     </effect>
                     <tooltip>
                        <Tooltip id="lNameToolTip" fx:id="lNameToolTip" contentDisplay="CENTER" text="Enter only characters, no spaces allowed" textAlignment="CENTER">
                           <font>
                              <Font name="Wawati SC Regular" size="13.0" />
                           </font>
                        </Tooltip>
                     </tooltip>
                  </TextField>
                  <TextField id="customerEmail_tField" fx:id="customerEmail_tField" accessibleRole="TEXT_FIELD" alignment="CENTER" layoutX="14.0" layoutY="188.0" prefHeight="35.0" prefWidth="230.0" promptText="Enter email address here" style="-fx-background-color: gray;">
                     <padding>
                        <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
                     </padding>
                     <font>
                        <Font name="Courier Oblique" size="14.0" />
                     </font>
                     <effect>
                        <Glow />
                     </effect>
                     <tooltip>
                        <Tooltip id="emailToolTip" fx:id="emailToolTip" contentDisplay="CENTER" text="Format: abc@xyz.com" textAlignment="CENTER">
                           <font>
                              <Font name="Wawati SC Regular" size="13.0" />
                           </font>
                        </Tooltip>
                     </tooltip>
                  </TextField>
                  <TextArea id="customerAddress_tArea" fx:id="customerAddress_tArea" layoutX="14.0" layoutY="236.0" prefHeight="42.0" prefWidth="230.0" promptText="Enter address here" style="-fx-background-color: gray; -fx-border-color: gray;" wrapText="true">
                     <opaqueInsets>
                        <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
                     </opaqueInsets>
                     <effect>
                        <ColorAdjust brightness="0.33" contrast="0.02" hue="0.12" saturation="-0.07">
                           <input>
                              <DropShadow />
                           </input>
                        </ColorAdjust>
                     </effect>
                     <font>
                        <Font name="Courier Oblique" size="14.0" />
                     </font>
                     <padding>
                        <Insets bottom="0.5" left="0.5" right="0.5" top="0.5" />
                     </padding>
                     <tooltip>
                        <Tooltip id="addressToolTip" fx:id="addressToolTip" contentDisplay="CENTER" text="Do not enter any special characters" textAlignment="CENTER">
                           <font>
                              <Font name="Wawati SC Regular" size="13.0" />
                           </font>
                        </Tooltip>
                     </tooltip>
                  </TextArea>
                  <Button id="customerSubmit_Button" fx:id="customerSubmit_Button" alignment="CENTER" contentDisplay="RIGHT" layoutX="149.0" layoutY="294.0" mnemonicParsing="false" prefHeight="35.0" prefWidth="95.0" style="-fx-background-color: wheat; -fx-border-color: brown;" text="Submit" textAlignment="CENTER" textFill="#081057">
                     <font>
                        <Font name="Wawati SC Regular" size="16.0" />
                     </font>
                     <opaqueInsets>
                        <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
                     </opaqueInsets>
                     <padding>
                        <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
                     </padding>
                  </Button>
                  <Label id="lblInvalidfName" fx:id="lblInvalidfName" alignment="CENTER" contentDisplay="CENTER" layoutX="251.0" layoutY="102.0" prefHeight="17.0" prefWidth="120.0" style="-fx-background-color: black; -fx-border-color: black;" text="Invalid First Name" textAlignment="CENTER" textFill="#d72323" textOverrun="CENTER_ELLIPSIS" visible="false">
                     <font>
                        <Font name="Wawati SC Regular" size="13.0" />
                     </font>
                     <opaqueInsets>
                        <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
                     </opaqueInsets>
                     <effect>
                        <Bloom threshold="0.22" />
                     </effect>
                     <cursor>
                        <Cursor fx:constant="DISAPPEAR" />
                     </cursor>
                  </Label>
                  <Label id="lblInvalidlName" fx:id="lblInvalidlName" alignment="CENTER" contentDisplay="CENTER" layoutX="251.0" layoutY="146.0" prefHeight="17.0" prefWidth="120.0" style="-fx-background-color: black; -fx-border-color: black;" text="Invalid Last Name" textAlignment="CENTER" textFill="#d72323" textOverrun="CENTER_ELLIPSIS" visible="false">
                     <font>
                        <Font name="Wawati SC Regular" size="13.0" />
                     </font>
                     <opaqueInsets>
                        <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
                     </opaqueInsets>
                     <effect>
                        <Bloom threshold="0.22" />
                     </effect>
                     <cursor>
                        <Cursor fx:constant="DISAPPEAR" />
                     </cursor>
                  </Label>
                  <Label id="lblInvalidEmail" fx:id="lblInvalidEmail" alignment="CENTER" contentDisplay="CENTER" layoutX="251.0" layoutY="188.0" prefHeight="17.0" prefWidth="120.0" style="-fx-background-color: black; -fx-border-color: black;" text="Invalid Email" textAlignment="CENTER" textFill="#d72323" textOverrun="CENTER_ELLIPSIS" visible="false">
                     <font>
                        <Font name="Wawati SC Regular" size="13.0" />
                     </font>
                     <opaqueInsets>
                        <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
                     </opaqueInsets>
                     <effect>
                        <Bloom threshold="0.22" />
                     </effect>
                     <cursor>
                        <Cursor fx:constant="DISAPPEAR" />
                     </cursor>
                  </Label>
                  <Label id="lblInvalidAddress" fx:id="lblInvalidAddress" alignment="CENTER" contentDisplay="CENTER" layoutX="251.0" layoutY="236.0" prefHeight="17.0" prefWidth="120.0" style="-fx-background-color: black; -fx-border-color: black;" text="Invalid Address" textAlignment="CENTER" textFill="#d72323" textOverrun="CENTER_ELLIPSIS" visible="false">
                     <font>
                        <Font name="Wawati SC Regular" size="13.0" />
                     </font>
                     <opaqueInsets>
                        <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
                     </opaqueInsets>
                     <effect>
                        <Bloom threshold="0.22" />
                     </effect>
                     <cursor>
                        <Cursor fx:constant="DISAPPEAR" />
                     </cursor>
                  </Label>
                  <Label id="lblInvalidUsername" fx:id="lblInvalidUsername" alignment="CENTER" contentDisplay="CENTER" layoutX="251.0" layoutY="14.0" prefHeight="17.0" prefWidth="120.0" style="-fx-background-color: black; -fx-border-color: black;" text="Invalid Username" textAlignment="CENTER" textFill="#d72323" textOverrun="CENTER_ELLIPSIS" visible="false">
                     <font>
                        <Font name="Wawati SC Regular" size="13.0" />
                     </font>
                     <opaqueInsets>
                        <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
                     </opaqueInsets>
                     <effect>
                        <Bloom threshold="0.22" />
                     </effect>
                     <cursor>
                        <Cursor fx:constant="DISAPPEAR" />
                     </cursor>
                  </Label>
               </children>
            </Pane>
         </center>
         <top>
            <Pane id="customerSignUpLabel_pane" fx:id="customerSignUpLabel_pane" prefHeight="57.0" prefWidth="600.0" BorderPane.alignment="CENTER">
               <children>
                  <Label id="customerSignUp_label" fx:id="customerSignUp_label" alignment="CENTER" contentDisplay="CENTER" layoutX="114.0" layoutY="14.0" prefHeight="46.0" prefWidth="341.0" style="-fx-background-color: gray;" text="Customer Sign Up ..." textAlignment="CENTER" textFill="#081057">
                     <padding>
                        <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
                     </padding>
                     <font>
                        <Font name="Copperplate Bold" size="28.0" />
                     </font>
                     <opaqueInsets>
                        <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
                     </opaqueInsets>
                  </Label>
               </children>
            </Pane>
         </top>
         <effect>
            <Bloom threshold="1.0">
               <input>
                  <ColorAdjust />
               </input>
            </Bloom>
         </effect>
      </BorderPane>
   </children>
   <opaqueInsets>
      <Insets />
   </opaqueInsets>
   <effect>
      <Blend opacity="0.55" />
   </effect>
</AnchorPane>

期待建议。

1 个答案:

答案 0 :(得分:0)

我解决了这个问题。 这是因为我的父窗格之一正在引用其他具有相同fx:id的其他fxml文件节点。

希望能帮助其他人面临类似问题。