

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 |
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.
| gui.Toolbars.ExampleFileFilter.ExampleFileFilter | ( | ) |
Creates a file filter. If no filters are added, then all files are accepted.
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.
Definition at line 126 of file ExampleFileFilter.java.
| 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.
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 .
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)"
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");
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();
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();
Definition at line 263 of file ExampleFileFilter.java.
Referenced by gui.Toolbars.ExampleFileFilter.getDescription().
Hashtable<String, ExampleFileFilter> gui.Toolbars.ExampleFileFilter.filters = null [private] |
Definition at line 68 of file ExampleFileFilter.java.
Referenced by gui.Toolbars.ExampleFileFilter.accept(), gui.Toolbars.ExampleFileFilter.addExtension(), and gui.Toolbars.ExampleFileFilter.getDescription().
String gui.Toolbars.ExampleFileFilter.description = null [private] |
Definition at line 69 of file ExampleFileFilter.java.
Referenced by gui.Toolbars.ExampleFileFilter.getDescription().
String gui.Toolbars.ExampleFileFilter.fullDescription = null [private] |
boolean gui.Toolbars.ExampleFileFilter.useExtensionsInDescription = true [private] |
Definition at line 71 of file ExampleFileFilter.java.
Referenced by gui.Toolbars.ExampleFileFilter.isExtensionListInDescription(), and gui.Toolbars.ExampleFileFilter.setExtensionListInDescription().
1.5.5