title: JFileChooser to pick a directory or a single file
body: <p>is it possible to make a JFileChooser which can choose a file or a directory?
  Because, if I use a filefilter in my chooser it is only possible to choose the files included the filter option, but I am no longer able to choose a directory.</p>
  
  <p>this is my JFileChooser</p>
  
  <pre><code>JFileChooser ch = new JFileChooser();
    ch.setAcceptAllFileFilterUsed(false);
    ch.setFileFilter(new FileFilter() {
  
      public boolean accept(File f) {
        if (f != null &amp;&amp; f.isDirectory()) {
          return true;
        }
        if (f == null || !f.getName().toUpperCase().endsWith(".PROPERTIES")) {
          return false;
        }
        return true;
      }
  
      public String getDescription() {
        return "Property Files" + " (*.properties)";
      }
    });
    ch.setCurrentDirectory(new File("."));
    ch.showOpenDialog(this);
    if (ch.getSelectedFile() != null) {
      ressource = ch.getSelectedFile();
    }
    else {
      return;
    }
    txtRessource.setText(ressource.getAbsolutePath());
  </code></pre>