Key code for <> signs for java robot class?
开发者_开发百科can you tell me the keycodes for Java Robot class.
For example, to press Enter we use: a.keyPress(KeyEvent.VK_ENTER);
a.keyRelease(KeyEvent.VK_ENTER);
I want to press these sysmbols >
and <
sign. What keyword or code should i use?
Assuming you mean java.awt.event.KeyInput
, then a quick glance at the documentation suggests that KeyInput.VT_LESS
and KeyInput.VT_GREATER
would correspond to the <
and >
keys.
Did you try VK_LESS, and VK_LESS in combination with SHIFT for >?
You'll need to do a VK_SHIFT press event, followed by a VK_COMMA press, then a VK_COMMA release and a VK_SHIFT release (assuming QWERTY keyboard). The system will reject a VK_LESS press because that's not a valid key without a shift event.
精彩评论