title: Can I use java.awt.FileDialog to only allow the user to select folders
body: <p>I'm trying to use FileDialog instead of JFileChooser to get more natural behaviour on OSX, especially important is the Favourites column with clear links to shared folders that are hidden under /Volumes using JFileChooser.</p>
  
  <p>I'm using Java 7, and for that reason I'm not using Quaqua JFileChooser as it hasnt been updated for a year and Im unsure if it compatible with Oracles Java 7. </p>
  
  <p>But Im hitting a problem, is there a way to get FileDialog to only allow a folder to be opened rather than a file, I set a filename filter but it seemed to have no effect and there is no</p>
  
  <pre><code>.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
  </code></pre>
  
  <p>like there is for JFileChooser.</p>
  
  <pre><code>public void actionPerformed(ActionEvent e)
  {
      FileDialog chooser = new FileDialog(SongKong.mainWindow.frame);
      chooser.setFilenameFilter(new FolderFilter());
      chooser.setMode(FileDialog.LOAD);
      chooser.setVisible(true);
      String folderSelected = chooser.getDirectory();
      File folder = new File(folderSelected) ;
      if(folder.exists() &amp;&amp; folder.isDirectory())
      {
          //Do something with selected folder
      }
  }
  
  class FolderFilter implements FilenameFilter
  {
      public boolean accept(File dir, String name)
      {
          return new File(dir,name).isDirectory();
      }
  }
  </code></pre>
  
  <p>(As an aside tried the code on WIndows 7 as well but still looks like Windopws XP dialog even though meant to be a native dialog, how come ?)</p>