Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Exit FX Stage or Scene by Pressing Esc Key
primaryStage.addEventHandler(KeyEvent.KEY_PRESSED, new EventHandler<KeyEvent>(){
@Override
public void handle(KeyEvent event) {
if(event.getCode() == KeyCode.ESCAPE){
primaryStage.close();
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment