code: public static void invalidateDialog (Component any)
      {
          JInternalDialog dialog = getInternalDialog(any);
          if (dialog == null) {
              return;
          }
  
          SwingUtil.applyToHierarchy(dialog, new SwingUtil.ComponentOp() {
              public void apply (Component comp) {
                  comp.invalidate();
              }
          });
  
          dialog.setSize(dialog.getPreferredSize());
      }
docs: Invalidates and resizes the entire dialog given any component
  within the dialog in question.