Java Swing Tutorial - Java JFileChooser .setMultiSelectionEnabled (boolean b)








Syntax

JFileChooser.setMultiSelectionEnabled(boolean b) has the following syntax.

public void setMultiSelectionEnabled(boolean b)

Example

In the following code shows how to use JFileChooser.setMultiSelectionEnabled(boolean b) method.

/*w  ww .j  av a 2 s. c o  m*/
import java.io.File;

import javax.swing.JFileChooser;

public class Main {
  public static void main(String[] argv) {
    JFileChooser chooser = new JFileChooser();
    chooser.setMultiSelectionEnabled(true);
    chooser.showOpenDialog(null);

    File[] files = chooser.getSelectedFiles();
  }
}