I created a PopUp with an extra FXML File and some Labels. Now I want to set the Labels, when the PopUp shows up, which does not work.
@FXML
private void handleButtonAction(ActionEvent event) throws
IOException, InterruptedException {
Stage stage;
Parent root;
if(event.getSource()==button) {
stage = new Stage();
root = FXMLLoader.load(getClass().getResource("popup.fxml"));
stage.setScene(new Scene(root));
stage.setTitle("New PopUp");
stage.initModality(Modality.APPLICATION_MODAL);
stage.initOwner(button.getScene().getWindow());
label1.setText("test");
stage.showAndWait();
}
else {
stage=(Stage)back.getScene().getWindow();
stage.close();
}
}
Do you have any hints where to set the label1 correctly? Thx