I don't know why this is not working. I want to set the text of a Label or Text. ( it does not matter which if it works). The label stays the same. When I use Text the application just crashes...
@FXML
public Text txtMessage;
@FXML
public Text txtTitle;
@FXML
public Text txtResult;
@FXML
public Label lblResult;
public void display(String title, String message) throws IOException {
txtResult = new Text();
lblResult = new Label();
Stage stage = new Stage();
stage.initModality(Modality.APPLICATION_MODAL);
Parent root= FXMLLoader.load(getClass().getResource("/Alertbox.fxml"));
lblResult.setText("message");
stage.setTitle(title);
stage.setScene(new Scene(root));
stage.show();
}
It has 2 parameters. I tried adding @FXML, or removing @FXML but both does not work. I also tried to initialize the label and text.
txtResult = new Text();
lblResult = new Label();
I debugged the code. message is a string and contains the right message.