All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.sun.java.swing.FileChooserFilter

java.lang.Object
   |
   +----com.sun.java.swing.FileChooserFilter

public class FileChooserFilter
extends Object
A filter object used to decide whether or not a file should be listed in a FileChooser dialog box. The filter is defined by a set of groups of file extensions.

See Also:
FileChooser

Constructor Index

 o FileChooserFilter()
Create a filter that is empty except for entries for all files and all filters
 o FileChooserFilter(String)
Similar to the previous constructor, but it also adds a string describing a group of extensions.

Method Index

 o accepts(String)
Returns true if this filter accepts (matches) the named file.
 o accepts(String, String)
Returns true if the particular filter group specified by the key accepts (matches) the named file.
 o add(String)
Add a string describing a group of file extensions to this filter.
 o addTo(Choice)
Add all the groups of extensions in this filter to a Choice box as seperate items per group.
 o getDirectoryFilter()
Get a filter that checks for directories

Constructors

 o FileChooserFilter
 public FileChooserFilter()
Create a filter that is empty except for entries for all files and all filters

 o FileChooserFilter
 public FileChooserFilter(String s)
Similar to the previous constructor, but it also adds a string describing a group of extensions.

Methods

 o getDirectoryFilter
 public static FileChooserFilter getDirectoryFilter()
Get a filter that checks for directories

 o add
 public void add(String s)
Add a string describing a group of file extensions to this filter. The string is simply a comma seperated list of file extensions, that is optionally wrapped in parenthesis with a preceeding comment. For example;
f.add("Web image (gif,jpeg,jpg)");

will add a group that matches files whose extensions are either "gif", "jpeg" or "jpg". The rest of the string is commentary.

 o addTo
 public void addTo(Choice c)
Add all the groups of extensions in this filter to a Choice box as seperate items per group. It's just the strings passed to add(s).

 o accepts
 public boolean accepts(String s)
Returns true if this filter accepts (matches) the named file. A file name matches if the string following the last '.' (The file extension) has been add()ed to this filter.

 o accepts
 public boolean accepts(String s,
                        String key)
Returns true if the particular filter group specified by the key accepts (matches) the named file. The key must be == to some string passed to add().


All Packages  Class Hierarchy  This Package  Previous  Next  Index