code: public static JInternalDialog getInternalDialog (Component any)
      {
          Component parent = any;
          while (parent != null && !(parent instanceof JInternalDialog)) {
              parent = parent.getParent();
          }
  
          return (JInternalDialog) parent;
      }
docs: Returns the internal dialog that is a parent of the specified
  component.