How can I use java.awt.Robot inside games?
问题 I am developing an Android application that controls the PC keyboard and mouse. I wanted to add a new feature (using your mobile as a game controller). I am using java.awt.Robot . It works fine in controlling the keyboard and mouse. But when I used it with games, java.awt.Robot doesn't press buttons. When I go outside the game, it works fine again. For example: if (senderPropertyOne.equalsIgnoreCase("l")) { robot.keyPress(KeyEvent.VK_LEFT); robot.keyRelease(KeyEvent.VK_LEFT); } else if