For my CS class they require us to use JavaFX alerts. I can make an alert appear, but how do I get what button was clicked? What would be the best way to go about getting this data?
Also if possible, I'd like to make it have a drop down panel and when the user selects and option the alert closes and prints what the user selected.
Here's some example code that I have. When I click one of the buttons, it just closes the dialog.
Alert a = new Alert(AlertType.NONE, "Promote pawn to:", new ButtonType("Queen"), new ButtonType("Rook"));
a.setTitle("Title");
a.setHeaderText("My header text");
a.setResizable(true);
a.setContentText("Content text");
a.showAndWait();
Thanks,
Alert. - James_DDialog<R>documentation says "A result converter must always be set, whenever the typeRis not Void or ButtonType.", butAlertextendsDialog<ButtonType>so the result converter doesn't apply. - James_D