public void synthesizeFocusInOut(boolean doFocus) { XFocusChangeEvent xev = new XFocusChangeEvent(); XToolkit.awtLock(); try { xev.set_type(doFocus ? FocusIn : FocusOut); xev.set_window(getFocusProxy().getWindow()); xev.set_mode(NotifyNormal); XlibWrapper.XSendEvent( XToolkit.getDisplay(), getFocusProxy().getWindow(), false, NoEventMask, xev.pData); } finally { XToolkit.awtUnlock(); xev.dispose(); } }