Load new fxml in borderpane center

一笑奈何 提交于 2019-12-02 10:43:00

You don't call setMain(...) on the controller that is created when you load MainWindowView.fxml. Consequently in MainWindowController when you try to do

main.getBorderPane()...

you get a null pointer exception.

In your start() method, you need to get the controller in the same way you do later in handleCustMenuButton(...), i.e.

    FXMLLoader loader = new FXMLLoader(Main.class.getResource("MainWindowView.fxml"));
    this.root = loader.load();

    // MainWindowController mwc = new MainWindowController();

    MainWindowController mwc = loader.getController();
    mwc.setMain(this);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!