I found one solution to the problem. I used JNA to generate keyboard events.
Here are some codes if someone needs them.
Basic information on using the JNA method and keybd_event from User32.dll:
import com.sun.jna.*; import com.sun.jna.Native; import com.sun.jna.platform.win32.User32; import com.sun.jna.win32.StdCallLibrary; public interface User32jna extends User32 { User32jna INSTANCE = (User32jna) Native.loadLibrary("user32.dll",User32jna.class); public void keybd_event(byte bVk, byte bScan, int dwFlags, int dwExtraInfo); } User32jna u32 = User32jna.INSTANCE;
And then paste this where you need to generate the key event:
u32.keybd_event((byte) 0x15,(byte)0xF2,0,0);
0x15 and 0xF2 is the virtual key code and keyboard scan code for the Hangul / English key that I was looking for, but find the codes for any key you need, and then replace them, and you can generate almost any key event.
For this you will need jna.jar and platform.jar.
source share