FileDocCategorySizeDatePackage
DirectoryChooser.javaAPI DocExample606Sun Mar 28 19:08:30 BST 1999None

DirectoryChooser

public class DirectoryChooser extends Object

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)

    
    JFileChooser fc = new JFileChooser();
    fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    
    int result = fc.showOpenDialog(new JFrame());
    if (result == JFileChooser.APPROVE_OPTION) {
      File dir = fc.getSelectedFile();
      String[] contents = dir.list();
      for (int i = 0; i < contents.length; i++) {
        System.out.println(contents[i]);
      }
    }
    
    System.exit(0);