FileExtensionFilter Class Reference

Inheritance diagram for FileExtensionFilter:

FileExcludeHiddenFilter FilesOnlyFilter List of all members.

Public Member Functions

 FileExtensionFilter ()
 FileExtensionFilter (String[] exts)
 FileExtensionFilter (String[] exts, boolean directories, Visibility vis)
 If there are dots in the beginning of the exts, we remove them, so that they will still work.
boolean accept (File f)
 This method is for filechoosers, and makes use of acceptDirectories.
boolean accept (File parentDir, String name)
String getDescription ()
 A string description to display in file choosers.
void setAcceptDirectories (boolean acceptDirs)
 If we are accepting directories, then ALL directories will be accepted.

Static Public Attributes

static final String[] ACCEPT_ALL = new String[] { "" }

Detailed Description

A Java FileFilter that accepts file extensions as Strings

This software is distributed under the BSD License.

Author:
Ron B Yeh (ronyeh(AT)cs.stanford.edu)

Definition at line 21 of file FileExtensionFilter.java.


Constructor & Destructor Documentation

FileExtensionFilter ( String[]  exts  ) 

Parameters:
exts 

Definition at line 52 of file FileExtensionFilter.java.

FileExtensionFilter ( String[]  exts,
boolean  directories,
Visibility  vis 
)

If there are dots in the beginning of the exts, we remove them, so that they will still work.

Parameters:
exts Pass in null or "" to accept all files. Otherwise, pass in an array of extensions without dots, such as {"jpg", "jpeg", "mpg", "mpeg"}. The matching is case INSENSITIVE.
directories true --> we will include directories.
vis BOTH --> we will include files or directories that are hidden or whose names start with dots (e.g., .bashrc).

Definition at line 70 of file FileExtensionFilter.java.

References FileExtensionFilter.ACCEPT_ALL.


Member Function Documentation

boolean accept ( File  f  ) 

This method is for filechoosers, and makes use of acceptDirectories.

See also:
javax.swing.filechooser.FileFilter.accept(java.io.File)
Note:
fixed bug from HCILib (which incorrectly says accept(null, ....))

Reimplemented in FileExcludeHiddenFilter.

Definition at line 99 of file FileExtensionFilter.java.

String getDescription (  ) 

A string description to display in file choosers.

See also:
javax.swing.filechooser.FileFilter.getDescription()

Definition at line 159 of file FileExtensionFilter.java.

void setAcceptDirectories ( boolean  acceptDirs  ) 

If we are accepting directories, then ALL directories will be accepted.

We do not apply extensions to directory names. This makes it so that directories will appear in the file chooser even if we have this FileExtensionFilter applied.

Parameters:
acceptDirs 

Definition at line 180 of file FileExtensionFilter.java.


The documentation for this class was generated from the following file:
Generated on Sat Apr 14 18:21:46 2007 for R3 Paper Toolkit by  doxygen 1.4.7