开发者

VK_xxx in Java for ~ (tilde), ? (question mark), % (percent), | (vert bar) and " (dbl quote)

开发者 https://www.devze.com 2023-02-07 05:52 出处:网络
I am trying to find the VK_xxx in KeyEvent for all the keys I can type in on my keyboard. I can find most of them, except the above 5. Any idea why these 5 are missing? Should I be using the shift mas

I am trying to find the VK_xxx in KeyEvent for all the keys I can type in on my keyboard. I can find most of them, except the above 5. Any idea why these 5 are missing? Should I be using the shift mask for these? If I go that route, can I use shift mask for 2 (VK_AT), 3 (VK_NUMBER_SIGN), 4 (VK_DOLLAR), etc., too?

The context - I am reading a String from a file than开发者_Go百科 contains arbitrary ASCII characters, and trying to have the AWT Robot press and release the VK's to put the string somewhere. Thank you.


http://download.oracle.com/javase/6/docs/api/java/awt/event/KeyEvent.html

It states: Not all characters have a keycode associated with them. For example, there is no keycode for the question mark because there is no keyboard for which it appears on the primary layer.

VK_DEAD_TILDE, VK_QUOTEDBL.

So you have also to capture the charCode event, besides keyReleased.

A bit unportable would be SHIFT+5 etc.


VK_BACK_QUOTE

{ Value: 192 HEX_Value: 0Xc0 CHAR_VALUE:'`' }


I discovered a way, if you press VK_CONTROL,VK_ALT, VK_W you can get a "?" question mark.

0

精彩评论

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