The Java Developers Almanac 1.4


Order this book from Amazon.

   
Home > List of Packages > javax.swing.filechooser  [19 examples] > Selections  [1 examples]

e895. Enabling Multiple Selections in a JFileChooser Dialog

    JFileChooser chooser = new JFileChooser();
    
    // Enable multiple selections
    chooser.setMultiSelectionEnabled(true);
    
    // Show the dialog; wait until dialog is closed
    chooser.showOpenDialog(frame);
    
    // Retrieve the selected files. This method returns empty
    // if multiple-selection mode is not enabled.
    File[] files = chooser.getSelectedFiles();

 Related Examples

See also: Events    Hidden Files    Icons    Layout   


© 2002 Addison-Wesley.