开发者

Java/AWT/Swing: how to distinguish the pressed enter or return key

开发者 https://www.devze.com 2023-01-08 05:10 出处:网络
It looks like native applications behave differently if the user presses the Return key (right to the characters) or the Enter key (number key pad) - one time a new line character is inserted, the 开发

It looks like native applications behave differently if the user presses the Return key (right to the characters) or the Enter key (number key pad) - one time a new line character is inserted, the 开发者_C百科other time the default button is activated.

How I can distinguish both key presses from Java/AWT/Swing?


keyEvent.getKeyLocation() == KeyEvent.KEY_LOCATION_NUMPAD
0

精彩评论

暂无评论...
验证码 换一张
取 消