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 / February 2006

Tip: Looking for answers? Try searching our database.

File filters

Thread view: 
steve_marjoribanks@hotmail.com - 16 Feb 2006 16:39 GMT
At the moment I have my JFileChooser and a FileFilter which specifies
that only files with the extension '.xml' will be shown. This works
fine, but when this filter is selected (which is the default) you can't
see any of the directories because they do not end in '.xml'. Is there
a way to apply the filter to files only, so that directories can still
be viewed when the filter is applied.
Many thanks

Steve
Oliver Wong - 16 Feb 2006 16:46 GMT
> At the moment I have my JFileChooser and a FileFilter which specifies
> that only files with the extension '.xml' will be shown. This works
[quoted text clipped - 3 lines]
> be viewed when the filter is applied.
> Many thanks

Instead of making your file filter do something like:

<pseudocode>
return file.endsWith(".xml");
</pseudocode>

make it do something like:

<pseudocode>
return file.endsWith(".xml") || file.isADirectory();
</pseudocode>

   - Oliver
steve_marjoribanks@hotmail.com - 16 Feb 2006 16:56 GMT
Yeah, thanks, I found the answer just after I posted! :-)

Steve


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



©2009 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.