I'm using javafx's webengine to display a web page. And on the page, there's script calling window.confirm. I already know how to set the confirm handler and how to show a modal-like dialog.
My question is how can I get the user's choice before handler returns?
webEngine.setConfirmHandler(new Callback<String, Boolean>() {
@Override
public Boolean call(String message) {
// Show the dialog
...
return true; // How can I get user's choice here?
}
});
As described in javafx-jira.kenai.com/browse/RT-19783, we can use the new method showAndWait which is available in JavaFx 2.2 to achieve this.
@jewelsea created a sample on https://gist.github.com/2992072. Thanks!