gui.Toolbars.ExampleFileFilter Class Reference

Inheritance diagram for gui.Toolbars.ExampleFileFilter:

Inheritance graph
[legend]
Collaboration diagram for gui.Toolbars.ExampleFileFilter:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 ExampleFileFilter ()
 ExampleFileFilter (String extension)
 ExampleFileFilter (String extension, String description)
 ExampleFileFilter (String[] filters)
 ExampleFileFilter (String[] filters, String description)
boolean accept (File f)
String getExtension (File f)
void addExtension (String extension)
String getDescription ()
void setDescription (String description)
void setExtensionListInDescription (boolean b)
boolean isExtensionListInDescription ()

Private Attributes

Hashtable< String,
ExampleFileFilter > 
filters = null
String description = null
String fullDescription = null
boolean useExtensionsInDescription = true


Detailed Description

A convenience implementation of FileFilter that filters out all files except for those type extensions that it knows about.

Extensions are of the type ".foo", which is typically found on Windows and Unix boxes, but not on Macinthosh. Case is ignored.

Example - create a new filter that filerts out all files but gif and jpg image files:

JFileChooser chooser = new JFileChooser(); ExampleFileFilter filter = new ExampleFileFilter( new String{"gif", "jpg"}, "JPEG & GIF Images") chooser.addChoosableFileFilter(filter); chooser.showOpenDialog(this);

Definition at line 65 of file ExampleFileFilter.java.


Constructor & Destructor Documentation

gui.Toolbars.ExampleFileFilter.ExampleFileFilter (  ) 

Creates a file filter. If no filters are added, then all files are accepted.

See also:
addExtension

Definition at line 79 of file ExampleFileFilter.java.

gui.Toolbars.ExampleFileFilter.ExampleFileFilter ( String  extension  ) 

Creates a file filter that accepts files with the given extension. Example: new ExampleFileFilter("jpg");

Definition at line 88 of file ExampleFileFilter.java.

gui.Toolbars.ExampleFileFilter.ExampleFileFilter ( String  extension,
String  description 
)

Creates a file filter that accepts the given file type. Example: new ExampleFileFilter("jpg", "JPEG Image Images");

Note that the "." before the extension is not needed. If provided, it will be ignored.

Definition at line 100 of file ExampleFileFilter.java.

gui.Toolbars.ExampleFileFilter.ExampleFileFilter ( String[]  filters  ) 

Creates a file filter from the given string array. Example: new ExampleFileFilter(String {"gif", "jpg"});

Note that the "." before the extension is not needed adn will be ignored.

Definition at line 114 of file ExampleFileFilter.java.

gui.Toolbars.ExampleFileFilter.ExampleFileFilter ( String[]  filters,
String  description 
)

Creates a file filter from the given string array and description. Example: new ExampleFileFilter(String {"gif", "jpg"}, "Gif and JPG Images");

Note that the "." before the extension is not needed and will be ignored.

See also:
addExtension

Definition at line 126 of file ExampleFileFilter.java.


Member Function Documentation

boolean gui.Toolbars.ExampleFileFilter.accept ( File  f  ) 

Return true if this file should be shown in the directory pane, false if it shouldn't.

Files that begin with "." are ignored.

See also:
getExtension

FileFilter.accepts

Definition at line 144 of file ExampleFileFilter.java.

String gui.Toolbars.ExampleFileFilter.getExtension ( File  f  ) 

Return the extension portion of the file's name .

See also:
getExtension

FileFilter.accept

Definition at line 163 of file ExampleFileFilter.java.

Referenced by gui.Toolbars.ExampleFileFilter.accept().

void gui.Toolbars.ExampleFileFilter.addExtension ( String  extension  ) 

Adds a filetype "dot" extension to filter against.

For example: the following code will create a filter that filters out all files except those that end in ".jpg" and ".tif":

ExampleFileFilter filter = new ExampleFileFilter(); filter.addExtension("jpg"); filter.addExtension("tif");

Note that the "." before the extension is not needed and will be ignored.

Definition at line 186 of file ExampleFileFilter.java.

Referenced by gui.Toolbars.ExampleFileFilter.ExampleFileFilter(), and gui.Toolbars.MyFileSaver.MyFileSaver().

String gui.Toolbars.ExampleFileFilter.getDescription (  ) 

Returns the human readable description of this filter. For example: "JPEG and GIF Image Files (*.jpg, *.gif)"

See also:
setDescription

setExtensionListInDescription

isExtensionListInDescription

FileFilter.getDescription

Definition at line 204 of file ExampleFileFilter.java.

void gui.Toolbars.ExampleFileFilter.setDescription ( String  description  ) 

Sets the human readable description of this filter. For example: filter.setDescription("Gif and JPG Images");

See also:
setDescription

setExtensionListInDescription

isExtensionListInDescription .property name="description"

Definition at line 231 of file ExampleFileFilter.java.

Referenced by gui.Toolbars.ExampleFileFilter.ExampleFileFilter(), and gui.Toolbars.MyFileSaver.MyFileSaver().

void gui.Toolbars.ExampleFileFilter.setExtensionListInDescription ( boolean  b  ) 

Determines whether the extension list (.jpg, .gif, etc) should show up in the human readable description.

Only relevent if a description was provided in the constructor or using setDescription();

See also:
getDescription

setDescription

isExtensionListInDescription

Definition at line 247 of file ExampleFileFilter.java.

boolean gui.Toolbars.ExampleFileFilter.isExtensionListInDescription (  ) 

Returns whether the extension list (.jpg, .gif, etc) should show up in the human readable description.

Only relevent if a description was provided in the constructor or using setDescription();

See also:
getDescription

setDescription

setExtensionListInDescription

Definition at line 263 of file ExampleFileFilter.java.

Referenced by gui.Toolbars.ExampleFileFilter.getDescription().


Member Data Documentation

Hashtable<String, ExampleFileFilter> gui.Toolbars.ExampleFileFilter.filters = null [private]


The documentation for this class was generated from the following file:

Generated on Tue Jul 8 15:05:55 2008 for NODIC by  doxygen 1.5.5