How to write a Java directory selector?

How to write a directory selector is as follows:

or

In Java?

PS 1: I'm developing a desktop application. I use swing in my application

PS 2: I'd like to list the contents

Solution

You can use treetable, which is a directory scanner. Using treetable and a pretty good tutorial: http://java.sun.com/products/jfc/tsc/articles/treetable1/

Your second photo looks like Jfilechooser

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

If you want to change its behavior, just create a myfilechooser class that extends Jfilechooser

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>