I want to load a FXML view into my program and save the view for later use.
I currently have a Pane that switches out FXML files.
@FXML private Pane contentPane;
@FXML
public void toHome() {
contentPane.getChildren().setAll(FXMLLoader.load(getClass().getResource("../fxml/Home.fxml")));
}
@FXML
public void toBrowse() {
contentPane.getChildren().setAll(FXMLLoader.load(getClass().getResource("../fxml/Browse.fxml")));
}
The thing is that I have text fields on each of the new FXML pages and when I switch pages, I don't want it to create a new FXML reference and lose the data in that text field. How can I keep the original page that I set?
Thanks,
Bart