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