Open another window on clicking OK button of Alert in JavaFX

Multi tool use
Multi tool use
The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


Open another window on clicking OK button of Alert in JavaFX


private void showAlert(Alert.AlertType alertType, Window owner, String title, String message) {
Alert alert = new Alert(alertType);
alert.setTitle(title);
alert.setHeaderText(null);
alert.setContentText(message);
alert.initOwner(owner);
//alert.show();

Optional<ButtonType> result = alert.showAndWait();
if ((result.isPresent()) && (result.get() == ButtonType.OK))
{
System.out.println("ALL OK..!");
//Open another window on clicking the OK button

}
}



On this particular section, on clicking OK button, I want to open another window.
Usually Button type is used for which an event can be defined by


buttonName.setOnAction( event -> {
//Action to do
} );



Now how do I define this OK as a button Type?









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

vrIH fo UIF 7b,fc3W7xy Afj
temYQP KdKm15RP8

Popular posts from this blog

Makefile test if variable is not empty

Visual Studio Code: How to configure includePath for better IntelliSense results

Will Oldham