static JRootPane getRootPane(Component a) { if (a instanceof JRootPane) return (JRootPane) a;  a = a.getParent();  if (a != null) { return getRootPane(a); }  return null; }
public static JRootPane getRootPane(Component comp) { if (comp instanceof RootPaneContainer) return ((RootPaneContainer)comp).getRootPane(); else return (JRootPane) getAncestorOfClass(JRootPane.class, comp); }
    static JRootPane getRootPane(Component a)    {	if (a instanceof JRootPane)	    return (JRootPane) a;		a = a.getParent();	if (a != null)	    {		return getRootPane(a);	    }	return null;    }