Skip to content

Instantly share code, notes, and snippets.

@smamran
Created September 20, 2015 13:52
Show Gist options
  • Save smamran/5391e7faade5c61d16a7 to your computer and use it in GitHub Desktop.
Save smamran/5391e7faade5c61d16a7 to your computer and use it in GitHub Desktop.
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