简体   繁体   English

JAVA中的Robot KeyEvent.VK_AT问题

[英]Robot KeyEvent.VK_AT Issue in JAVA

I created Robot class in JAVA but there is a issue robot.keyPress(KeyEvent.VK_AT) have to press -> '@' -> at 我在JAVA中创建了Robot类,但出现了一个问题robot.keyPress(KeyEvent.VK_AT)必须按-> '@' -> at

But it presses 'q' <-> 'Q' 但是按'q' <-> 'Q'

What should i do to robot press '@' symbol ? 我应该如何对机器人按“ @”符号?

On my keyboard, the @ key requires combining the Shift and 2 keys; 在我的键盘上, @键需要组合Shift键2键; others may vary. 其他可能会有所不同。 The test image below was produced by adding the following to this example . 通过将以下内容添加到此示例中来产生以下测试图像。

Addendum: As noted in comments by @neat159, the host OS keyboard control panel setting must match the intended keyboard layout being tested. 附录:如@ neat159的注释中所述,主机操作系统键盘控制面板设置必须与要测试的预期键盘布局匹配。

r.keyPress(KeyEvent.VK_SHIFT);
r.keyPress(KeyEvent.VK_2);
r.keyRelease(KeyEvent.VK_2);
r.keyRelease(KeyEvent.VK_SHIFT);

图片

您是否尝试过使用常数KeyEvent.VK_AMPERSAND?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM