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.

Product icon

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.

Passing keyboard event programmatically

Vivek Gade
6 years ago May 04, 2016 8:36am
Nick Rapellas
6 years ago May 17, 2016 2:35pm

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();
            } catch (AWTException e) {
                LogManager.error(logger, "F11 key could not be pressed",e);