|
JClass DesktopViews 6.3.0 API Documentation |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.swing.filechooser.FileFilter | +--com.klg.jclass.util.swing.JCFileFilter
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 Macintosh. Case is ignored.
Example - create a new filter that filters out all files but gif and jpg image files:
JFileChooser chooser = new JFileChooser(); JCFileFilter filter = new JCFileFilter( new String{"gif", "jpg"}, "JPEG & GIF Images") chooser.addChoosableFileFilter(filter); chooser.showOpenDialog(this);
Field Summary | |
protected Hashtable |
filters
|
Constructor Summary | |
JCFileFilter()
Creates a file filter. |
|
JCFileFilter(String extension)
Creates a file filter that accepts files with the given extension. Example: new JCFileFilter("jpg"); |
|
JCFileFilter(String[] filters)
Creates a file filter from the given String array. Example: new JCFileFilter(String {"gif", "jpg"});
|
|
JCFileFilter(String[] filters,
String description)
Creates a file filter from the given string array and description. Example: new JCFileFilter(String {"gif", "jpg"}, "Gif and JPG
Images");
|
|
JCFileFilter(String extension,
String description)
Creates a file filter that accepts the given file type. Example: new JCFileFilter("jpg", "JPEG Image Images");
|
Method Summary | |
boolean |
accept(File f)
Returns true if this file should be shown in the directory pane;
false if it shouldn't. |
void |
addExtension(String extension)
Adds a filetype "dot" extension to filter against. |
String |
getDescription()
Returns the human readable description of this filter. |
String |
getExtension(File f)
Returns the extension portion of the file's name. |
String |
getExtension(String s)
Returns the extension portion of a String. |
boolean |
isExtensionListInDescription()
Returns whether the extension list (.jpg, .gif, etc) should show up in the human readable description. |
void |
setDescription(String description)
Sets the human readable description of this filter. |
void |
setExtensionListInDescription(boolean b)
Determines whether the extension list (.jpg, .gif, etc) should show up in the human readable description. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected Hashtable filters
Constructor Detail |
public JCFileFilter()
addExtension(java.lang.String)
public JCFileFilter(String extension)
new JCFileFilter("jpg");
extension
- addExtension(java.lang.String)
public JCFileFilter(String extension, String description)
new JCFileFilter("jpg", "JPEG Image Images");
Note: The "." before the extension is not needed. If provided, it will be ignored.
extension
- description
- addExtension(java.lang.String)
public JCFileFilter(String[] filters)
new JCFileFilter(String {"gif", "jpg"});
Note: The "." before the extension is not needed and will be ignored.
filters
- addExtension(java.lang.String)
public JCFileFilter(String[] filters, String description)
new JCFileFilter(String {"gif", "jpg"}, "Gif and JPG
Images");
Note: The "." before the extension is not needed and will be ignored.
filters
- description
- addExtension(java.lang.String)
Method Detail |
public boolean accept(File f)
true
if this file should be shown in the directory pane;
false
if it shouldn't.
accept
in interface FileFilter
accept
in class FileFilter
f
-
getExtension(java.lang.String)
,
FileFilter.accept(java.io.File)
public String getExtension(String s)
s
-
public String getExtension(File f)
f
-
getExtension(java.lang.String)
,
FileFilter.accept(java.io.File)
public void addExtension(String extension)
JCFileFilter filter = new JCFileFilter(); filter.addExtension("jpg"); filter.addExtension("tif");
extension
- public String getDescription()
getDescription
in class FileFilter
setDescription(java.lang.String)
,
setExtensionListInDescription(boolean)
,
isExtensionListInDescription()
,
FileFilter.getDescription()
public void setDescription(String description)
filter.setDescription("Gif and JPG Images");
description
- getDescription()
,
setExtensionListInDescription(boolean)
,
isExtensionListInDescription()
public void setExtensionListInDescription(boolean b)
setDescription()
.
b
- getDescription()
,
setDescription(java.lang.String)
,
isExtensionListInDescription()
public boolean isExtensionListInDescription()
setDescription()
.
getDescription()
,
setDescription(java.lang.String)
,
setExtensionListInDescription(boolean)
|
Copyright © 2004 Quest Software Inc.. All rights reserved. |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |