Java JFileChooser DIRECTORIES_ONLY

Syntax

JFileChooser.DIRECTORIES_ONLY has the following syntax.

public static final int DIRECTORIES_ONLY

Example

In the following code shows how to use JFileChooser.DIRECTORIES_ONLY field.


//w w w.  j  a  v  a 2s .c  om
import javax.swing.JFileChooser;

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