参数类型不匹配打开新阶段时出现异常

时间:2016-12-31 12:29:44

标签: java exception javafx scene stage

在我的java应用程序中,我只想在登录成功后打开一个新的fxml窗口。 登录成功完成后,新窗口成功打开。 但即使一切正常,我也会收到错误:

root = FXMLLoader.load(getClass().getResource("../ui/frmMain_ui.fxml"));

我很困惑这是定义位置的问题.. 我的项目大纲:

文件夹:src>文件夹:ui> .fxml文件

文件夹:src> folder:base> .java控制器文件

文件夹:src>文件夹:MainView> Main.java,ShowForm.java

例外:

Exception in thread "JavaFX Application Thread" java.lang.IllegalArgumentException: argument type mismatch
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:71)
    at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:275)
    at javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1769)
    at javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(FXMLLoader.java:1657)
    at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
    at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49)
    at javafx.event.Event.fireEvent(Event.java:198)
    at javafx.scene.control.Tab$1.invalidated(Tab.java:209)
    at javafx.beans.property.BooleanPropertyBase.markInvalid(BooleanPropertyBase.java:109)
    at javafx.beans.property.BooleanPropertyBase.set(BooleanPropertyBase.java:144)
    at javafx.scene.control.Tab.setSelected(Tab.java:185)
    at javafx.scene.control.TabPane$TabPaneSelectionModel.select(TabPane.java:722)
    at javafx.scene.control.TabPane$TabPaneSelectionModel.select(TabPane.java:735)
    at javafx.scene.control.TabPane$TabPaneSelectionModel.findNearestAvailableTab(TabPane.java:794)
    at javafx.scene.control.TabPane$TabPaneSelectionModel.lambda$new$17(TabPane.java:691)
    at com.sun.javafx.collections.ListListenerHelper$Generic.fireValueChangedEvent(ListListenerHelper.java:329)
    at com.sun.javafx.collections.ListListenerHelper.fireValueChangedEvent(ListListenerHelper.java:73)
    at javafx.collections.ObservableListBase.fireChange(ObservableListBase.java:233)
    at javafx.collections.ListChangeBuilder.commit(ListChangeBuilder.java:482)
    at javafx.collections.ListChangeBuilder.endChange(ListChangeBuilder.java:541)
    at javafx.collections.ObservableListBase.endChange(ObservableListBase.java:205)
    at javafx.collections.ModifiableObservableListBase.add(ModifiableObservableListBase.java:155)
    at java.util.AbstractList.add(AbstractList.java:108)
    at javafx.fxml.FXMLLoader$Element.add(FXMLLoader.java:168)
    at javafx.fxml.FXMLLoader$PropertyElement.add(FXMLLoader.java:1403)
    at javafx.fxml.FXMLLoader$ValueElement.processEndElement(FXMLLoader.java:788)
    at javafx.fxml.FXMLLoader.processEndElement(FXMLLoader.java:2823)
    at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2532)
    at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2441)
    at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3214)
    at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3175)
    at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3148)
    at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3124)
    at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3104)
    at javafx.fxml.FXMLLoader.load(FXMLLoader.java:3097)
    at MainView.ShowForm.showFrmMain**(ShowForm.java:20)**
    at base.frmLogin_base.openFrom_Main**(frmLogin_base.java:56)**
    at base.frmLogin_base.ActionLogin**(frmLogin_base.java:69)**
    at base.frmLogin_base.do_btnLogin**(frmLogin_base.java:43)**
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:71)
    at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:275)
    at javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1769)
    at javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(FXMLLoader.java:1657)
    at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
    at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
    at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49)
    at javafx.event.Event.fireEvent(Event.java:198)
    at javafx.scene.Node.fireEvent(Node.java:8411)
    at javafx.scene.control.Button.fire(Button.java:185)
    at com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(ButtonBehavior.java:182)
    at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:96)
    at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:89)
    at com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:218)
    at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
    at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
    at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
    at javafx.event.Event.fireEvent(Event.java:198)
    at javafx.scene.Scene$MouseHandler.process(Scene.java:3757)
    at javafx.scene.Scene$MouseHandler.access$1500(Scene.java:3485)
    at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1762)
    at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2494)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:380)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:294)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$354(GlassViewEventHandler.java:416)
    at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:389)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:415)
    at com.sun.glass.ui.View.handleMouseEvent(View.java:555)
    at com.sun.glass.ui.View.notifyMouse(View.java:937)

这是我的ShowForm.java:

public class ShowForm {
    public void showFrmMain(Stage mainStage){
        Parent root = null;
        mainStage = new Stage();
        mainStage.setTitle("Welcome to Dashboard");
        try {
            root = FXMLLoader.load(getClass().getResource("../ui/frmMain_ui.fxml"));
            mainStage.setScene(new Scene(root));
            mainStage.show();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

这是我的登录操作方法:

private void ActionLogin(){
        try {
            if(this.LoginProcess(frmLogin_tbxUsername.getText().toString(), frmLogin_tbxPassword.getText().toString())){
                UpdateStatus();
                alert = new Alert(Alert.AlertType.INFORMATION);
                alert.setTitle("Information");
                alert.setHeaderText("Success !");
                alert.setContentText("Successfully Logged In !");

                alert.showAndWait();

                openFrom_Main();  // open form method
                frmLogin_btnLogin.getScene().getWindow().hide();
            }else{
                alert = new Alert(Alert.AlertType.WARNING);
                alert.setTitle("Information");
                alert.setHeaderText("Failed !");
                alert.setContentText("Incorrect Credentials, Please try again !");

                alert.showAndWait();

                frmLogin_tbxUsername.clear();
                frmLogin_tbxPassword.clear();
            }
        }catch (Exception ERROR){
            ERROR.printStackTrace();
        }
    }

我的openForm_Main()方法:

private void openFrom_Main(){
        new MainView.ShowForm().showFrmMain(new Stage());
    }

实际上frmMain没有任何内容。 这是我的frmMain_base.java(Controller):

package base;

import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.*;
import javafx.scene.paint.Color;
import javafx.scene.text.Font;

public class frmMain_base {

    @FXML
    private Menu frmMain_TitleBar;

    @FXML
    private Label frmMain_txtDateTime;

    @FXML
    private TableColumn<?, ?> frmMain_tableCol_From;

    @FXML
    private TabPane frmMain_tabMsgPane;

    @FXML
    private Tab frmMain_tabContacts;

    @FXML
    private MenuItem frmMain_MenuItemAbout;

    @FXML
    private TableView<?> frmMain_tableView_Message;

    @FXML
    private Label frmMain_txtFullName;

    @FXML
    private ListView<?> frmMain_ListView_Contacts;

    @FXML
    private Label frmMain_txtStatus;

    @FXML
    private Button frmMain_msg_btnSend;

    @FXML
    private Tab frmMain_tabInbox;

    @FXML
    private Tab frmMain_Tab_Milestones;

    @FXML
    private TextField frmMain_msg_tbxMessage;

    @FXML
    private Tab frmMain_Tab_Issues;

    @FXML
    private SplitPane frmMain_SplitPane;

    @FXML
    private TextArea frmMain_msg_tbxMsgBox;

    @FXML
    private Tab frmMain_Tab_Resolved;

    @FXML
    private Button frmMain_btnLogout;

    @FXML
    private Tab frmMain_Tab_Features;

    @FXML
    private Font x1;

    @FXML
    private Color x2;

    @FXML
    private TabPane frmMain_TabPane;

    @FXML
    private Font x3;

    @FXML
    private TableColumn<?, ?> frmMain_tabCol_Message;

    @FXML
    private Color x4;

    @FXML
    private Label frmMain_txtRank;

    @FXML
    void do_ClickTitleBar(ActionEvent event) {

    }

    @FXML
    void do_MenuItemAbout(ActionEvent event) {

    }

    @FXML
    void do_tabContacts_changing(ActionEvent event) {

    }

    @FXML
    void do_OnMouseClick_ListView_Contacts(ActionEvent event) {

    }

    @FXML
    void do_tabInbox_changing(ActionEvent event) {

    }

    @FXML
    void do_msg_btnSend(ActionEvent event) {

    }

    @FXML
    void do_btnLogout(ActionEvent event) {

    }

}

这是我的frmMain_ui.fxml:

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

<?import java.lang.*?>
<?import java.util.*?>
<?import javafx.geometry.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.paint.*?>
<?import javafx.scene.text.*?>

<VBox prefHeight="600.0" prefWidth="1100.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="base.frmMain_base">
  <children>
    <MenuBar VBox.vgrow="NEVER">
      <menus>
        <Menu fx:id="frmMain_TitleBar" mnemonicParsing="false" onAction="#do_ClickTitleBar" text="FiKHSONS INTERNATIONAL Software Dashboard" />
        <Menu mnemonicParsing="false" text="Help">
          <items>
            <MenuItem fx:id="frmMain_MenuItemAbout" mnemonicParsing="false" onAction="#do_MenuItemAbout" text="About" />
          </items>
        </Menu>
      </menus>
    </MenuBar>
    <SplitPane fx:id="frmMain_SplitPane" dividerPositions="0.23385300668151449, 0.8708240534521158" focusTraversable="true" prefHeight="-1.0" prefWidth="-1.0" VBox.vgrow="ALWAYS">
      <items>
        <AnchorPane>
          <children>
            <Label alignment="CENTER" layoutX="14.0" layoutY="14.0" minWidth="60.0" prefWidth="-1.0" style="&#10;" text="Messages" textAlignment="CENTER" wrapText="false">
              <font>
                <Font size="18.0" fx:id="x1" />
              </font>
              <textFill>
                <Color blue="0.624" green="0.624" red="0.624" fx:id="x2" />
              </textFill>
            </Label>
                  <SplitPane dividerPositions="0.5" layoutX="4.0" layoutY="43.0" orientation="VERTICAL" prefHeight="499.0" prefWidth="246.0" AnchorPane.bottomAnchor="4.0" AnchorPane.leftAnchor="4.0" AnchorPane.rightAnchor="4.0" AnchorPane.topAnchor="45.0">
                    <items>
                      <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="100.0" prefWidth="160.0">
                           <children>
                              <TabPane fx:id="frmMain_tabMsgPane" layoutX="51.0" layoutY="31.0" prefHeight="245.0" prefWidth="243.0" tabClosingPolicy="UNAVAILABLE" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
                                <tabs>
                                  <Tab fx:id="frmMain_tabContacts" onSelectionChanged="#do_tabContacts_changing" text="Contacts">
                                    <content>
                                      <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0">
                                             <children>
                                                <ListView fx:id="frmMain_ListView_Contacts" layoutX="22.0" layoutY="14.0" onMouseClicked="#do_OnMouseClick_ListView_Contacts" prefHeight="212.0" prefWidth="243.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
                                             </children>
                                          </AnchorPane>
                                    </content>
                                  </Tab>
                                  <Tab fx:id="frmMain_tabInbox" onSelectionChanged="#do_tabInbox_changing" text="Inbox">
                                    <content>
                                      <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0">
                                             <children>
                                                <TableView fx:id="frmMain_tableView_Message" layoutX="22.0" layoutY="6.0" prefHeight="212.0" prefWidth="243.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
                                                  <columns>
                                                    <TableColumn fx:id="frmMain_tabCol_Message" editable="false" prefWidth="140.0" resizable="false" text="Message" />
                                                    <TableColumn fx:id="frmMain_tableCol_From" editable="false" minWidth="4.0" prefWidth="84.0" resizable="false" text="From" />
                                                  </columns>
                                                </TableView>
                                             </children>
                                          </AnchorPane>
                                    </content>
                                  </Tab>
                                </tabs>
                              </TabPane>
                           </children>
                        </AnchorPane>
                      <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="100.0" prefWidth="160.0">
                           <children>
                              <GridPane layoutX="5.0" layoutY="162.0" prefHeight="30.0" prefWidth="217.0" AnchorPane.bottomAnchor="5.0" AnchorPane.leftAnchor="5.0" AnchorPane.rightAnchor="5.0">
                                <columnConstraints>
                                  <ColumnConstraints hgrow="SOMETIMES" maxWidth="176.0" minWidth="10.0" prefWidth="157.0" />
                                  <ColumnConstraints hgrow="SOMETIMES" maxWidth="135.0" minWidth="10.0" prefWidth="43.0" />
                                </columnConstraints>
                                <rowConstraints>
                                  <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
                                </rowConstraints>
                                 <children>
                                    <Button fx:id="frmMain_msg_btnSend" alignment="CENTER" contentDisplay="CENTER" defaultButton="true" mnemonicParsing="false" onAction="#do_msg_btnSend" prefHeight="26.0" prefWidth="54.0" text="Send" textAlignment="JUSTIFY" GridPane.columnIndex="1" GridPane.halignment="CENTER" GridPane.hgrow="ALWAYS" GridPane.valignment="CENTER" GridPane.vgrow="ALWAYS" />
                                    <TextField fx:id="frmMain_msg_tbxMessage" promptText="Enter your message here !" GridPane.halignment="CENTER" GridPane.hgrow="ALWAYS" GridPane.valignment="CENTER" GridPane.vgrow="ALWAYS" />
                                 </children>
                              </GridPane>
                              <AnchorPane layoutX="22.0" layoutY="10.0" prefHeight="200.0" prefWidth="200.0" AnchorPane.bottomAnchor="40.0" AnchorPane.leftAnchor="5.0" AnchorPane.rightAnchor="5.0" AnchorPane.topAnchor="5.0">
                                 <children>
                                    <TextArea fx:id="frmMain_msg_tbxMsgBox" editable="false" layoutX="17.0" layoutY="14.0" prefHeight="200.0" prefWidth="233.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
                                 </children>
                              </AnchorPane>
                           </children>
                        </AnchorPane>
                    </items>
                  </SplitPane>
          </children>
        </AnchorPane>
      <AnchorPane id="Content" minHeight="-1.0" minWidth="-1.0" prefHeight="545.0" prefWidth="430.0">
        <children>
          <Label alignment="CENTER" font="$x1" layoutX="14.0" layoutY="14.0" style="&#10;" text="Tasks &amp; Scheduling" textAlignment="CENTER" textFill="$x2" wrapText="false" />
                  <AnchorPane layoutX="14.0" layoutY="57.0" prefHeight="478.0" prefWidth="537.0" AnchorPane.bottomAnchor="14.0" AnchorPane.leftAnchor="14.0" AnchorPane.rightAnchor="14.0" AnchorPane.topAnchor="57.0">
                     <children>
                        <TabPane fx:id="frmMain_TabPane" layoutX="143.0" layoutY="100.0" prefHeight="478.0" prefWidth="663.0" style="-fx-border-width: 3.5; -fx-border-color: gray;" tabClosingPolicy="UNAVAILABLE" tabMinWidth="80.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
                          <tabs>
                            <Tab fx:id="frmMain_Tab_Issues" text="Issues">
                              <content>
                                <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0" />
                              </content>
                            </Tab>
                            <Tab fx:id="frmMain_Tab_Milestones" text="Milestones">
                              <content>
                                <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0" />
                              </content>
                            </Tab>
                              <Tab fx:id="frmMain_Tab_Features" text="Features">
                                <content>
                                  <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0" />
                                </content>
                              </Tab>
                              <Tab fx:id="frmMain_Tab_Resolved" text="Resolved">
                                <content>
                                  <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0" />
                                </content>
                              </Tab>
                          </tabs>
                        </TabPane>
                     </children>
                  </AnchorPane>
                  <Button fx:id="frmMain_btnLogout" alignment="CENTER" contentDisplay="CENTER" layoutX="619.0" layoutY="13.0" mnemonicParsing="false" onAction="#do_btnLogout" text="Logout" textAlignment="JUSTIFY" AnchorPane.rightAnchor="12.0" AnchorPane.topAnchor="13.0" />
        </children>
      </AnchorPane>
        <AnchorPane prefWidth="100.0" SplitPane.resizableWithParent="false">
          <children>
                  <SplitPane dividerPositions="0.1882998171846435" orientation="VERTICAL" prefHeight="549.0" prefWidth="160.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
                    <items>
                      <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="100.0" prefWidth="160.0">
                           <children>
                              <GridPane layoutX="-51.0" layoutY="5.0" prefHeight="99.0" prefWidth="137.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
                                <columnConstraints>
                                  <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
                                </columnConstraints>
                                <rowConstraints>
                                  <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
                                  <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
                                  <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
                                </rowConstraints>
                                 <children>
                                    <Label fx:id="frmMain_txtFullName" alignment="CENTER" cache="true" contentDisplay="CENTER" text="txtFullName" textAlignment="JUSTIFY" GridPane.halignment="CENTER" GridPane.valignment="CENTER">
                                       <font>
                                          <Font size="10.0" />
                                       </font>
                                    </Label>
                                    <Label fx:id="frmMain_txtRank" alignment="CENTER" cache="true" contentDisplay="CENTER" text="txtRank" textAlignment="JUSTIFY" GridPane.halignment="CENTER" GridPane.rowIndex="1" GridPane.valignment="CENTER">
                                       <font>
                                          <Font size="10.0" />
                                       </font>
                                    </Label>
                                    <Label alignment="CENTER" cache="true" text="Mood Coming Soon" textAlignment="JUSTIFY" GridPane.halignment="CENTER" GridPane.rowIndex="2" GridPane.valignment="CENTER">
                                       <font>
                                          <Font size="10.0" />
                                       </font>
                                    </Label>
                                 </children>
                              </GridPane>
                           </children>
                        </AnchorPane>
                      <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="440.0" prefWidth="100.0" SplitPane.resizableWithParent="false">
                           <children>
                        <Label alignment="CENTER" contentDisplay="CENTER" font="$x1" style="&#10;" text="News" textAlignment="CENTER" textFill="$x2" wrapText="false" />
                           </children>
                        </AnchorPane>
                    </items>
                  </SplitPane>
          </children>
        </AnchorPane>
      </items>
    </SplitPane>
    <HBox id="HBox" alignment="CENTER_LEFT" spacing="5.0" VBox.vgrow="NEVER">
      <children>
        <Label fx:id="frmMain_txtStatus" maxHeight="1.7976931348623157E308" maxWidth="-1.0" text="Status" HBox.hgrow="ALWAYS">
          <font>
            <Font size="11.0" fx:id="x3" />
          </font>
          <textFill>
            <Color blue="0.625" green="0.625" red="0.625" fx:id="x4" />
          </textFill>
        </Label>
        <Pane prefHeight="-1.0" prefWidth="-1.0" HBox.hgrow="ALWAYS" />
        <Label fx:id="frmMain_txtDateTime" font="$x3" maxWidth="-1.0" text="Date &amp; Time" textFill="$x4" HBox.hgrow="NEVER" />
      </children>
      <padding>
        <Insets bottom="3.0" left="3.0" right="3.0" top="3.0" />
      </padding>
    </HBox>
  </children>
</VBox>

我实际上不确定为什么这个例外正在发生,即使一切正常。 如果有人能够指出它并给我一个明确的解释我做错了什么或者我应该以正确的方式做什么,这将是非常有用的。

提前致谢!

1 个答案:

答案 0 :(得分:0)

好的,我终于解决了。

问题在于我的frmMain_ui.fxml控制器类(frmMain_base.java)中的EventHandler ..

是:

@FXML
void do_tabContacts_changing(ActionEvent event) {

}

@FXML
void do_tabInbox_changing(ActionEvent event) {

}

解决方案应该是&#34;事件&#34;而不是&#34; ActionEvent&#34;,因为这些是调用组件变化状态的事件:

@FXML
void do_tabContacts_changing(Event event) {

}

@FXML
void do_tabInbox_changing(Event event) {

}

感谢@James_D兄弟让我朝这个方向前进。