Q:

javafx - how to bind the DialogEvent.DIALOG_SHOWN on a Dialog?

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?

A:

This works for me.
getDialogPane().getScene().getWindow().addEventHandler(WindowEvent.WINDOW_SHOWN,
            s -> System.out.println("hello"));

