import javax.swing.JFileChooser; public class Main { public static void main(String[] argv) { JFileChooser fileChooser = new JFileChooser("."); fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); } }