Java KeyListener:KeyTyped退格键,Esc作为输入 [英] Java KeyListener: KeyTyped Backspace, Esc as input

查看:89
本文介绍了Java KeyListener:KeyTyped退格键,Esc作为输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

KeyTyped方法中,如何确定是否按下了 Backspace Esc ?

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

推荐答案

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

arg0.getKeyChar()强制转换为一个整数:(int)arg0.getKeyChar()时,退格键的值为8,而Esc键的值为27.

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.

这篇关于Java KeyListener:KeyTyped退格键,Esc作为输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆