Hy there,
i am implementing JavaFX 1.8U45 Dialogs.
Now i got stuck on a problem cause i cannot reach the stage or scene of the dialog.
I am trying to add an EventHandler to the dialog, to prevent it from closing by pressing ESC Key
In my Dialog extended class i try to do something like this:
getOwner().getScene().setOnKeyPressed(new EventHandler<KeyEvent>() {
@Override
public void handle(KeyEvent event) {
if (event.getCode().equals(KeyCode.ESCAPE)) {
LOG.info("ESC was pressed on ABFDIALOG !!");
event.consume();
}
}
});
But get Owner is initialized by me with the baseApplications scene.
If i set the owner of the dialog to null i even cannot access its new created stage/scene
I dont know where to add my EventHandler in the dialog class and could not find the
jdk implementation where it says to close the dialog when esc is pressed ....
Thanks for hints
so long
Harry