0

I can add this code to hook into the stage close event:

stage.setOnCloseRequest(new EventHandler<WindowEvent>() { public void handle(WindowEvent we) { System.out.println("Stage is closing"); // but wait! I don't want it to close! } }); 

but how do I stop the stage from closing?

1
  • For example. Commented Jun 4, 2017 at 12:14

1 Answer 1

1

I refer to this comment:

Platform.setImplicitExit(false); primaryStage.setOnCloseRequest(new EventHandler<WindowEvent>() { @Override public void handle(WindowEvent event) { event.consume(); } }); 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.