1

I am sucessfull in creating key pressed event for characters and numbers. But when I press any of the function key, the code doesn't detect it. I have used .getCharacter() to get the key pressed. This is what I have done so far

@FXML
private void checkKeyTyped(KeyEvent e) {

    System.out.println("Pressed key : " + e.getCharacter());
}

When I press any normal keys, it prints the key but when I press any special key like a function key or esc, it doesn't detect anything. Do I have to first get the ASCII value of the key?

viper
  • 1,836
  • 4
  • 25
  • 41

1 Answers1

1

Not every Key is mapped to a Character.

Check KeyEvent.getCode () and the relevant constants in KeyCode.

Jan
  • 13,738
  • 3
  • 30
  • 55