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 ;-).
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.