Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Browse for folder dialog

I need to know how to get the "browse for folder" dialog in java. I am aware of SWT. But I need to do in swing? Is there any solution to this?

[As we start on eclipse it will ask for choose workspace. We can see the browse for folder dialog at that time] Thanks in advance.

like image 840
Sri Sri Avatar asked Jan 24 '11 06:01

Sri Sri


People also ask

What is folder Browser dialog vb net?

The Windows Forms FolderBrowserDialog component is a modal dialog box that is used for browsing and selecting folders. New folders can also be created from within the FolderBrowserDialog component. To select files, instead of folders, use the OpenFileDialog component.


1 Answers

You can force JFileChooser to select only folders, if you add the following command.

        _fileChooser.setFileSelectionMode( JFileChooser.DIRECTORIES_ONLY); 

in the snippet that Bibhaw posted.

like image 114
Stathis Alexopoulos Avatar answered Sep 25 '22 13:09

Stathis Alexopoulos