Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / November 2007

Tip: Looking for answers? Try searching our database.

Need to modify JFileChooser's default behavior

Thread view: 
Ramon F Herrera - 13 Nov 2007 02:15 GMT
The problem I am facing is solved in Unix with this:

> ls -ld *

My JFileChooser instance is supposed to retrieve a filepath with a
directory at the end.

An option would be to have a double click opening directories and a
button press to signify the end of the search. Or I could even hava
one button to open folders and another to signify that I am done.

What needs to be done to have JFileChooser chose directories?

Is there a JDirectoryChooser?  :-)

-Ramon
Andrew Thompson - 13 Nov 2007 02:26 GMT
...
>What needs to be done to have JFileChooser chose directories?
>
>Is there a JDirectoryChooser?  :-)

Whoa!  Nothing so drastic.  You might try RTFM first.
<http://java.sun.com/javase/6/docs/api/javax/swing/JFileChooser.html#setFileSelec
tionMode(int

)>

Signature

Andrew Thompson
http://www.athompson.info/andrew/

Roedy Green - 13 Nov 2007 02:42 GMT
On Mon, 12 Nov 2007 18:15:52 -0800, Ramon F Herrera
<ramon@conexus.net> wrote, quoted or indirectly quoted someone who
said :

>What needs to be done to have JFileChooser chose directories?

You have at least two tools at your disposal without even subclassing:

addChoosableFileFilter(FileFilter filter)
setFileSelectionMode(int mode)

see http://mindprod.com/jgloss/jfilechooser.html
Signature

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

Ramon F Herrera - 13 Nov 2007 04:58 GMT
> The problem I am facing is solved in Unix with this:
>
[quoted text clipped - 8 lines]
>
> What needs to be done to have JFileChooser chose directories?

> Is there a JDirectoryChooser class?  :-)

Well, perhaps there isn't such a class per se, but this comes pretty
darn close:

  fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);

-Ramon


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.