JComponent (Component aComponent) { if (aComponent instanceof JComponent) { return (JComponent)aComponent; } if (aComponent instanceof RootPaneContainer) { return ((RootPaneContainer)aComponent).getRootPane(); } LOG.error("Cannot find target for:" + aComponent); return null; }