I just played with an on-screen keyboard and saw that it was easy. You just need to call it using Runtime.exec() or ProcessBuilder . Then, if your application has lost focus, return it to the application, while the active element should be the current editable element (text field, text area, etc.). Now, when the user enters the virtual keyboard, the characters are written to your application.
EDIT
There are some difficulties with running osk.exe from java. This throws an IOException: java.io.IOException: Cannot run program "C:\Windows\System32\osk.exe": CreateProcess error=740, The requested operation requires elevation
The trick is to run the command through the shell ( cmd ):
Runtime.getRuntime().exec("cmd /c C:\\Windows\\System32\\osk.exe");
This line works great on my car.
Alexr source share