|
FreeHEP API Version current |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.swing.filechooser.FileFilter org.freehep.swing.ExtensionFileFilter
A FileFilter which filters out all files except those which end with the given tag. This filter is case sensitive and the string is compared literally. You may add extensions with or without the leading dot. The comparison always uses the leading dot. Long extensions such as ".heprep.zip" are also allowed. Example - create a new filter that filerts out all files but gif and jpg image files:
JFileChooser chooser = new JFileChooser(); ExtensionFileFilter filter = new ExtensionFileFilter( new String{".gif", ".jpg"}, "JPEG & GIF Images") chooser.addChoosableFileFilter(filter); chooser.showOpenDialog(this);Based on the ExtensionFileFilter written by Jeff Dinkins and provided by Sun.
Constructor Summary | |
ExtensionFileFilter()
Creates a file filter. |
|
ExtensionFileFilter(String extension)
Creates a file filter that accepts files with the given ending. |
|
ExtensionFileFilter(String[] filters)
Creates a file filter from the array of given endings. |
|
ExtensionFileFilter(String[] filters,
String description)
Creates a file filter from the given string array and description. |
|
ExtensionFileFilter(String extension,
String description)
Creates a file filter that accepts the files with the given endings. |
Method Summary | |
boolean |
accept(File f)
Return true if this file should be shown in the directory pane, false if it shouldn't. |
void |
addExtension(String extension)
Adds an extension to filter against. |
String |
getDescription()
Returns the human readable description of this filter. |
String |
getExtension(File f)
Returns the extension portion of the files name (if part of this file filter). |
boolean |
isExtensionListInDescription()
Returns whether the extension list (.jpg, .gif, etc) should show up in the human readable description. |
protected boolean |
match(File f)
This determines if the file matches any of the extensions. |
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 |
Constructor Detail |
public ExtensionFileFilter()
addExtension(java.lang.String)
public ExtensionFileFilter(String extension)
addExtension(java.lang.String)
public ExtensionFileFilter(String extension, String description)
addExtension(java.lang.String)
public ExtensionFileFilter(String[] filters)
addExtension(java.lang.String)
public ExtensionFileFilter(String[] filters, String description)
addExtension(java.lang.String)
Method Detail |
public boolean accept(File f)
FileFilter.accept(java.io.File)
protected boolean match(File f)
public String getExtension(File f)
public void addExtension(String extension)
public String getDescription()
setDescription(java.lang.String)
,
setExtensionListInDescription(boolean)
,
isExtensionListInDescription()
,
FileFilter.getDescription()
public void setDescription(String description)
setDescription(java.lang.String)
,
setExtensionListInDescription(boolean)
,
isExtensionListInDescription()
public void setExtensionListInDescription(boolean b)
getDescription()
,
setDescription(java.lang.String)
,
isExtensionListInDescription()
public boolean isExtensionListInDescription()
getDescription()
,
setDescription(java.lang.String)
,
setExtensionListInDescription(boolean)
|
FreeHEP API Version current |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |