Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Do not close Stage on Alt-F4

856309Jun 27 2012 — edited Jun 28 2012
Easy question, is there any way to remove the Stage closing when Alt-F4 is pressed. I tried with
stage.addEventHandler(KeyEvent.ANY, new EventHandler<KeyEvent>() {

			@Override
			public void handle(final KeyEvent ev) {
				if(ev.getCode()==KeyCode.F4 && ev.isAltDown()) {
					System.out.println("Captured");
					ev.consume();
				}
			}
		});
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 26 2012
Added on Jun 27 2012
4 comments
1,845 views