Justin Justin - 2 years ago 125
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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download