workInvalidComponents.clear();
  public void validateInvalidComponents()  {    // In order to keep the blocking of application threads minimal, we switch    // the invalidComponents field with the workInvalidComponents field and    // work with the workInvalidComponents field.    synchronized(this)    {      ArrayList swap = invalidComponents;      invalidComponents = workInvalidComponents;      workInvalidComponents = swap;    }    for (Iterator i = workInvalidComponents.iterator(); i.hasNext(); )      {        Component comp = (Component) i.next();        // Find validate root.        while ((!(comp instanceof JComponent)               || !((JComponent) comp).isValidateRoot())               && comp.getParent() != null)          comp = comp.getParent();        // Validate the validate root.        if (! (comp.isVisible() && comp.isShowing()))          continue;        comp.validate();      }    workInvalidComponents.clear();  }