Type a String using java.awt.Robot

Common solution is to use the clipboard: String text = “Hello World”; StringSelection stringSelection = new StringSelection(text); Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); clipboard.setContents(stringSelection, stringSelection); Robot robot = new Robot(); robot.keyPress(KeyEvent.VK_CONTROL); robot.keyPress(KeyEvent.VK_V); robot.keyRelease(KeyEvent.VK_V); robot.keyRelease(KeyEvent.VK_CONTROL);

Convert String to KeyEvents

I’m basically using a glorified switch statement. Simple and fast: import static java.awt.event.KeyEvent.*; public class Keyboard { private Robot robot; public static void main(String… args) throws Exception { Keyboard keyboard = new Keyboard(); keyboard.type(“Hello there, how are you?”); } public Keyboard() throws AWTException { this.robot = new Robot(); } public Keyboard(Robot robot) { this.robot = … Read more

How to simulate a real mouse click using java?

Well I had the same exact requirement, and Robot class is perfectly fine for me. It works on windows 7 and XP (tried java 6 & 7). public static void click(int x, int y) throws AWTException{ Robot bot = new Robot(); bot.mouseMove(x, y); bot.mousePress(InputEvent.BUTTON1_DOWN_MASK); bot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); } May be you could share the name of the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)