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
-
FileChooserFilter()
- Create a filter that is empty except for entries for
all files and all filters
-
FileChooserFilter(String)
- Similar to the previous constructor, but it also adds a
string describing a group of extensions.
-
accepts(String)
- Returns true if this filter accepts (matches) the named file.
-
accepts(String, String)
- Returns true if the particular filter group specified by
the key accepts (matches) the named file.
-
add(String)
- Add a string describing a group of file extensions
to this filter.
-
addTo(Choice)
- Add all the groups of extensions in this filter to a
Choice box as seperate items per group.
-
getDirectoryFilter()
- Get a filter that checks for directories
FileChooserFilter
public FileChooserFilter()
- Create a filter that is empty except for entries for
all files and all filters
FileChooserFilter
public FileChooserFilter(String s)
- Similar to the previous constructor, but it also adds a
string describing a group of extensions.
getDirectoryFilter
public static FileChooserFilter getDirectoryFilter()
- Get a filter that checks for directories
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.
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).
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.
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