-
FileFilters in Java
Is there anyway to set what files are filtered in a JFileChooser dialog box
in java? I've got a line that goes:
fileChooser.setFileFilter(filter);
but I need to know really how to extend the FileFilter class to make it useful!
I want to be able to just display *.JPW files and set the name of this filter
to Java Person Files(s), so if anyone can help, please mail me ;-).
+ Checkout http://www.birches.pwp.blueyonder.co.uk/html/index.htm if you
want to play frogger or Pontoon and tell me what you think.
-
Re: FileFilters in Java
Hi
class MyFiles implements FileFilter
{
public boolean accept(File f)
{
if(f.getName().endsWith(".jpw"))
return true;
return false;
}
public String getDescription()
{
return "Your Files (*.jpw)";
}
}
Now set this instance as filefilter for filechooser
Regards
Rajkamal
"Simon Birch" <the_dougle@hotmail.com> wrote:
>
>Is there anyway to set what files are filtered in a JFileChooser dialog
box
>in java? I've got a line that goes:
>
> fileChooser.setFileFilter(filter);
>
>but I need to know really how to extend the FileFilter class to make it
useful!
> I want to be able to just display *.JPW files and set the name of this
filter
>to Java Person Files(s), so if anyone can help, please mail me ;-).
>
>+ Checkout http://www.birches.pwp.blueyonder.co.uk/html/index.htm if you
>want to play frogger or Pontoon and tell me what you think.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks