How can I write a selection of Java directory?

How can I write a selection list like this:

enter image description here

or: enter image description here

in Java?

PS 1: I am developing a desktop application and I use Swing in my application.

PS 2: I want to list only directories.

+3
source share
1 answer

You can use TreeTable, here is a directory scanner that uses a standard table with a pretty decent tutorial: http://java.sun.com/products/jfc/tsc/articles/treetable1/

The second image looks the same as JFileChooser ...

      JFileChooser fileChooser = new JFileChooser(file);
      fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);

If you want to change its behavior, just create a class MyFileChooser, which extends JFileChooser.

+12
source

All Articles