Please take time to read the code disclaimer.
package folderfinder; import java.io.*; import javax.swing.filechooser.FileSystemView; /** * *Titre : JFolderChooseer
* *Description : A replacement for JFileChooser to select Directory
* *Copyright : Copyright (c) 2006
* *Soci�t� : PSafix.org
* * @author Michel PRUNET * @version 1.0 */ public class DirectoryFileFilter implements FileFilter { public DirectoryFileFilter() { } /** * Tests whether or not the specified abstract pathname should be included * in a pathname list. * * @param pathname The abstract pathname to be tested * @returntrueif and only ifpathnameshould * be included * @todo Impl�menter cette m�thode java.io.FileFilter */ public boolean accept(File pathname) { return pathname.isDirectory() || FileSystemView.getFileSystemView().isComputerNode(pathname) || FileSystemView.getFileSystemView().isDrive(pathname) || // FileSystemView.getFileSystemView().isFileSystem(pathname) || FileSystemView.getFileSystemView().isFileSystemRoot(pathname) || FileSystemView.getFileSystemView().isFloppyDrive(pathname); } }