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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With