Java examples for JavaFX:Key Event
is ESC key pressed JavaFX KeyEvent
//package com.java2s; import javafx.scene.input.KeyCode; import javafx.scene.input.KeyEvent; public class Main { public static boolean isESC(KeyEvent event) { boolean esc = event.getCode() == KeyCode.ESCAPE; if (!esc) { String str = event.getCharacter(); if (!str.isEmpty()) { esc = str.charAt(0) == 27; }// www.j a v a 2 s. co m } return esc; } }