i am quite new to javafx. I saw many ways of switching between screens but they somehow didn't work after some thinking, i thought of using this logic. Please i need to know if it is advice-able for me to continue with it, before i go too far in the project.
@FXML
public void nextAfterPassangerButtonClicked() throws Exception {
MainScreenDatabaseHandler a = new MainScreenDatabaseHandler(getId(), getFirstName(), getLastName(), getOtherName(), getSexSelection(), getMobileNumber(), getEmergencyContact(), getHomeAdress());
//send collected data to database
passangerPaymentAnchorPane.getChildren().remove(0);
Node node = FXMLLoader.load(getClass().getResource("CargoPayment.fxml"));
passangerPaymentAnchorPane.getChildren().add(node);
}
//Handle All Menu Bar Buttons
@FXML
public void startPageBarButtonClicked() throws Exception {
passangerPaymentAnchorPane.getChildren().remove(0);
mainAnchor.getChildren().remove(0);
Node node = FXMLLoader.load(getClass().getResource("MainScreen.fxml"));
mainAnchor.getChildren().add(node);
}
public void allPassangersMenuBarButtonClicked() throws Exception {
passangerPaymentAnchorPane.getChildren().remove(0);
Node node = FXMLLoader.load(getClass().getResource("AllPassangersView.fxml"));
passangerPaymentAnchorPane.getChildren().add(node);
}
when i click on one of the buttons, it removes the current scene and loads the related fxml. Thank You. The passangerPaymentAnchorPane acts like the mother pane on which other fxml loads and unload