0
I have a registration screen, using FXML
, and want to reuse this screen for the change button.
But when I do:
txtNome.setText("ola");
System.out.println(txtNome.getText());
Opens the registration screen, with the field Nome
blank, console returns "ola"
and returns no error.
Code that opens the registration screen:
public void newPage(String path){
try {
Stage stage;
Parent root;
FXMLLoader fxmlLoader = new FXMLLoader();
fxmlLoader.setLocation(getClass().getClassLoader().getResource(path));
root = fxmlLoader.load();
stage = new Stage();
stage.initModality(Modality.APPLICATION_MODAL);
txtNome = new TextField();
txtNome.setText("ola");
System.out.println(txtNome.getText());
stage.setScene(new Scene(root, 900, 900));
stage.showAndWait();
} catch(Exception e) {
e.printStackTrace();
}
}