Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

TUTORIALVaadin lets you build secure, UX-first PWAs entirely in Java.
Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
CssImport when using Component Exporter by Mikhail Shabarov, 4 weeks ago
Passing keyboard event programmatically
Hi Guys!
Is there any way by which we can generate the keyboard event programmatically?
Last updated on
Hi,
I suppose you mean "press a specific button at the keyboard??"
I'm using the following code with success...
import java.awt.AWTException;
import java.awt.Robot;
import java.awt.event.KeyEvent
obot robot;
try {
robot = new Robot();
robot.keyPress(KeyEvent.VK_F11);
robot.keyRelease(KeyEvent.VK_F11);
} catch (AWTException e) {
LogManager.error(logger, "F11 key could not be pressed",e);
}
Last updated on
+1
You cannot reply to this thread.