Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > How to gray out the files in JFileChooser?

Reply
Thread Tools

How to gray out the files in JFileChooser?

 
 
RC
Guest
Posts: n/a
 
      04-25-2007
I only let user select the directories,
not let user select the files.

So I

myFileChooser.setFileSelectionMode(JFileChooser.DI RECTORIES_ONLY);

That is fine, but user complain about that, they want to
make sure there are files under the directory.

If I do

myFileChooser.setFileSelectionMode(JFileChooser.FI LES_AND_DIRECTORIES);

Then user will mistake select a file, which I don't let them select a
file. I need to popup a dialog says "Please select a directory only".

The idea thing is I can gray out the file names, so user can see
there are files under a directory, but they can't select any file,
only can select a directory.

Anyone out there has any idea how to gray out the file names in
JFileChooser?

Thank Q!
 
Reply With Quote
 
 
 
 
derek
Guest
Posts: n/a
 
      04-25-2007
continue to show only directories like you have.
but, use a filter to only show directories that contain files.

there is documentation on this in the java api docs.

http://java.sun.com/j2se/1.5.0/docs/...leChooser.html

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Using an "All" Checkbox to gray out CheckBoxList Chris Lincoln ASP .Net 1 07-02-2007 08:03 PM
How to grey/gray out a JButton? RC Java 2 04-11-2006 05:49 PM
How to gray out IE proxy settings screen =?Utf-8?B?Sm9ieQ==?= MCSE 13 03-16-2005 03:25 PM
gray out textbow clietside? Davef ASP .Net 0 08-15-2003 05:59 PM



Advertisments