Java - Robot keyPress issue
Posted
by
Trimbitas Sorin
on Stack Overflow
See other posts from Stack Overflow
or by Trimbitas Sorin
Published on 2011-02-15T19:30:52Z
Indexed on
2011/02/16
23:25 UTC
Read the original article
Hit count: 229
I'm trying to send keystrokes (like a virtual keyboard) from my Java code, but I encounter some issues. It works perfectly on normal applications (for example, Notepad, browsers, etc.), but not on games (fullscreen or windowed mode).
This is the stripped code I'm using:
import java.awt.Robot;
import java.awt.AWTException;
import java.awt.event.InputEvent;
Robot robot;
robot.keyPress(KeyEvent.VK_A);
robot.keyRelease(KeyEvent.VK_A);
How can this problem be fixed?
© Stack Overflow or respective owner