Java Swing Tutorial - 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.


import javax.swing.JFileChooser;

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