I am working on creating an on-screen keyboard with java. This keyboard has a JComponent for every possible key. When a down mouse is detected on the button, I want to send a specific keyboard code to the application that is currently in focus. The keyboard itself is located within the JFrame without decoration and is always installed on top.
I found that the Robot class can be used to simulate these keyboard events in its own queue. However, in this case, choosing JComponent means that the keystroke is accepted on the JFrame , and I could not get it in another application
How can I keep the on-screen keyboard “Always out of focus”? Is it possible to use a different approach to send keystrokes?
source share