简体   繁体   中英

How can I write a Java directory chooser?

How can I write a directory chooser as like that:

在此处输入图像描述

or:在此处输入图像描述

at Java?

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

PS 2: I want to list just directories.

You could use a TreeTable, here's a directory scanner using a treetable with a pretty decent tutorial: http://java.sun.com/products/jfc/tsc/articles/treetable1/

Your second picture looks just like JFileChooser...

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

If you want to change it's behavior just create a MyFileChooser class that extends JFileChooser.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM