In the LoginWindowController class, we have a line of code
NextWindowController nextController = loader.getController();.
Can someone explain what it's for cause I can't find where we use it. Thanks.
Rest of code:
@FXML
public void handleNext() throws IOException {
FXMLLoader loader = new FXMLLoader(getClass().getResource("NextWindow.fxml"));
AnchorPane root = (AnchorPane)loader.load();
NextWindowController nextController = loader.getController();
nextController.updateName(textfieldName.getText());
Scene nextScene = new Scene(root,root.getPrefWidth(),root.getPrefHeight());
nextScene.getStylesheets().add(getClass().getResource("application.css").toExternalForm());
Stage primary = (Stage) btnNext.getScene().getWindow();
primary.setScene(nextScene);
// Stage stage = new Stage();
// stage.setScene(scene);
// stage.show();
// btnNext.getScene().getWindow().hide();
//primaryStage.setScene(scene);
//primaryStage.show();
}