code: public static void dismissDialog (Component child)
      {
          if (child == null) {
              return;
          } else if (child instanceof JInternalDialog) {
              ((JInternalDialog)child).dismissDialog();
          } else {
              dismissDialog(child.getParent());
          }
      }
docs: Scans up the interface hierarchy looking for the {@link
  JInternalDialog} that contains the supplied child component and
  dismisses it.