Justin Justin - 1 year ago 60
Java Question

Java KeyListener: KeyTyped Backspace, Esc as input

Inside the

method, how do I tell if Backspace or Esc is being pressed?

Answer Source


When arg0.getKeyChar() is cast to an int: (int)arg0.getKeyChar(), The backspace key comes up with the value 8, and the Esc key comes up with the value 27.