code: public static RootPaneContainer getRootPaneContainer(Component component) {
  	if (component instanceof RootPaneContainer) {
  	  return (RootPaneContainer) component;
  	}
  
  	for (Container p = component.getParent(); p != null; p = p.getParent()) {
  	  if (p instanceof RootPaneContainer) {
  		return (RootPaneContainer) p;
  	  }
  	}
  	return null;
    }
docs: Get the RootPaneContainer of the specific component.
  
  @param component
  @return the RootPaneContainer or <CODE>NULL</CODE> if its not exist.