问题描述:

This question already has an answer here:

  • Passing Parameters JavaFX FXML

    6 answers

网友答案:

Your error is basically because of the below line

FXMLLoader loader = FXMLLoader.load(getClass().getClassLoader().
                              getResource("filetree/childWindow.fxml"), resources);

Here, you are trying to create a FXMLLoader reference, but instead you have used the load() of the FXMLLoader.

FXMLLoader's load() will load the Pane which is used as the root in the FXML. So, instead of using

FXMLLoader.load()

you must directly use

FXMLLoader fxmlLoader = new FXMLLoader(getClass().getClassLoader().
                              getResource("filetree/childWindow.fxml"), resources);
相关阅读:
Top