Java KeyListener: KeyTyped Backspace, Esc as input

前端 未结 7 1066
耶瑟儿~
耶瑟儿~ 2020-12-29 10:33

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

7条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-29 10:55

    http://www.fileformat.info/info/unicode/char/8/index.htm

    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.

提交回复
热议问题