Java examples for Swing:JFileChooser
Displaying Only Directories in a File Chooser Dialog
import java.io.File; import javax.swing.JFileChooser; public class Main { public static void main(String[] argv) { JFileChooser fileChooser = new JFileChooser(new File("")); fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); }/* w ww . j a va2 s . c o m*/ }