How to gray out the files in JFileChooser?

R

RC

I only let user select the directories,
not let user select the files.

So I

myFileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_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.FILES_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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top