当前位置: 动力学知识库 > 问答 > 编程问答 >

java - JavaFX Parameter passing

问题描述:

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);
分享给朋友:
您可能感兴趣的文章:
随机阅读: