Reputation: 2347
On a Stage I can do the following:
getScene().addEventHandler(WindowEvent.WINDOW_SHOWN, s -> {});
On Dialog, the following DOES NOT WORK:
getDialogPane().getScene().addEventHandler(WindowEvent.WINDOW_SHOWN, s -> {});
getDialogPane().getScene().addEventHandler(DialogEvent.DIALOG_SHOWN, s -> {});
This works:
setOnShown(e -> {});
But I want do use the addEventHandler so other events can be added.
How can I archieve this?
Upvotes: 0
Views: 104
Reputation: 165
This works for me.
getDialogPane().getScene().getWindow().addEventHandler(WindowEvent.WINDOW_SHOWN,
s -> System.out.println("hello"));
Upvotes: 1