private void typeKey(int keyCode) { if (keyCode == -1) return; // press key X11.XTest.INSTANCE.XTestFakeKeyEvent( display.getX11Display(), keyCode, true, new NativeLong(DELAY)); X11.INSTANCE.XFlush(display.getX11Display()); // release key X11.XTest.INSTANCE.XTestFakeKeyEvent( display.getX11Display(), keyCode, false, new NativeLong(DELAY)); X11.INSTANCE.XFlush(display.getX11Display()); }
private void typeKey(String keyName) { X11.KeySym keysym = X11.INSTANCE.XStringToKeysym(keyName); typeKey(X11.INSTANCE.XKeysymToKeycode(display.getX11Display(), keysym)); }