aspose file tools*
The moose likes Java in General and the fly likes Setting a filename filter in Filedialog Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Setting a filename filter in Filedialog" Watch "Setting a filename filter in Filedialog" New topic
Author

Setting a filename filter in Filedialog

krish chandru
Ranch Hand

Joined: Apr 27, 2001
Posts: 39
I need to create a File dialog that shows only the available directories in the drive and not any files. Can i achieve this using the File Name filter ? if yes, Please let me know how i can do this !
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9043
    
  10
What about

boolean isDirectory()
Tests whether the file denoted by this abstract pathname is a directory.

in the File class?


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
krish chandru
Ranch Hand

Joined: Apr 27, 2001
Posts: 39
Yes , using isDirectory i can very well confirm a directory but i need to set a filter in the filedialog itself so that i can restrict the user to the level of directories. The user can select only the directory and cant descend to the file structure level.
whenever a user clicks the browse button he should be shown only the available directories and not the files !
Peter den Haan
author
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
Originally posted by krish chandru:
Yes , using isDirectory i can very well confirm a directory but i need to set a filter in the filedialog itself [...]
What is your filter but an object that confirms directories? Have a look at the FileFilter class, it'll take you all of five minutes to do.
- Peter
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Setting a filename filter in Filedialog
 
Similar Threads
Filter Problem
Struts Filter in Web.xml
Filter Problems in Web.xml
Problem with web fragments
How to make Filter getting called only once for every User