I have a mainView.fxml which includes 3 separate fxml files. My mainView is designed like that (VBox)
+------------------------+
+ menu (menu.fxml)       +
+------------------------+
+ toolbar (toolbar.fxml) +
+------------------------+
+                        +
+ dashboardHome          +
+ (dashboardHome.fxml)   +
+------------------------+
All they have their own controllers.
Now I want to load a different dashboardhome content depending on the toolbar button I clicked.
In the toolbarController I put
public void onButton3Click(ActionEvent actionEvent) throws IOException {
        MainController main = new MainController();
        main.loadContent();
    }
and in the MainController I put
@FXML
private AnchorPane dashboardHome;
public void loadContent() throws IOException {
        FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("view/courseView.fxml"));
        AnchorPane newPane = fxmlLoader.load();
        dashboardHome.getChildren().setAll(newPane);
    }
Gives me Caused by: java.lang.IllegalStateException: Location is not set.
How can I change the dashboardHome AnchorPane?
(generally speaking is my approach correct to modularise the design like that or are there better practices recommended? thanks - I am still at the bottom of the learning curve)
 
    