In JavaFX, how can I get the event if a user clicks the Close Button(X) (right most top cross) a stage?
I want my application to print a debug message when the window is
stage.setOnCloseRequest(new EventHandler() { public void handle(WindowEvent we) { System.out.println("Stage is closing"); } });