My main application runs in a JFXTabPane
, having multiple tabs.
In a special case I want to load another AnchorPane
on top of the entire application.
RootController.java
JFXTabPane tabPane = new JFXTabPane();
tab = new Tab("Tab 1");
tabPane.getTabs().add(tab);
borderPane.setCenter(tabPane);
loader = new FXMLLoader(getClass().getClassLoader().getResource("fxml1.fxml"));
parent = loader.load();
tab.setContent(parent);
Controller controller = loader.getController();
/* ... Loading more tabs ... */
/* Loading the additional `AnchorPane`, that needs to be loaded at a later point */
AnchorPane pane = FXMLLoader.load(getClass().getClassLoader().getResource("fxml2.fxml"));
Fxml1Controller.java
Pane pane;
/* Registering that AnchorPane in the Controller */
public void setPane(Pane p) {
this.pane = p;
}
My approach is to set the pane to visible an bring it to front when needed:
private void showPane(ActionEvent event) {
pane.setVisible(true);
pane.toFront();
System.out.println(pane);
}
But it doesn't change anything.
So, how can I display the AnchorPane
on top of my JFXTabPane
?