I am loading a list of FXML files through my Main App. But I am having an issue displaying inside TabPane using its FX:ID. this TabPane is under a borderPane. I am able to access the center of the borderPane but I can't access the TabPane beneath it.
here is my setup
In my start:
@Override
public void start(Stage primaryStage) {
this.primaryStage = primaryStage;
initRootLayout();
showPersonOverview();
}
In my init
public void initRootLayout() {
try {
FXMLLoader loader = new FXMLLoader();
loader.setLocation(MainApp.class
.getResource("view/RootLayout.fxml"));
//Note this line, I am setting up my rootLayout to be the
//mainBorderPane, but I want it to be an AnchorePane under the main
//BorderPane
rootLayout = (BorderPane) loader.load();
Scene scene = new Scene(rootLayout);
primaryStage.setScene(scene);
RootLayoutController controller = loader.getController();
controller.setMainApp(this);
primaryStage.show();
} catch (IOException e) {
e.printStackTrace();
}
Here is what I am having an issue with. I can't display this in the TabPane mentioned above.
public void showPersonOverview() {
try {
FXMLLoader loader = new FXMLLoader();
loader.setLocation(MainApp.class.getResource("view/PersonOverview.fxml"));
AnchorPane personOverview = (AnchorPane) loader.load();
//Here I am displaying the personOverview inside the main boarderPane
rootLayout.setCenter(personOverview);
PersonOverviewController controller = loader.getController();
controller.setMainApp(this);
} catch (IOException e) {
e.printStackTrace();
}
}