Rectangle (final TextHitInfo offset) { if (ApplicationManager.getApplication().isDispatchThread()) return myDelegate.getTextLocation(offset); final Rectangle[] r = new Rectangle[1]; try { SwingUtilities.invokeAndWait(new Runnable() { public void run() { r[0] = myDelegate.getTextLocation(offset); } }); } catch (InterruptedException e) { LOG.error(e); } catch (InvocationTargetException e) { LOG.error(e); } return r[0]; }