if (listingMode == JFileChooser.DIRECTORIES_ONLY) return directories; else if (listingMode == JFileChooser.FILES_ONLY) return contents.size() - directories;
  public int getSize()  {    if (listingMode == JFileChooser.DIRECTORIES_ONLY)      return directories;    else if (listingMode == JFileChooser.FILES_ONLY)      return contents.size() - directories;    return contents.size();  }