|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.swing.filechooser.FileFilter org.proteinshader.gui.utils.FileExtensionFilter
public class FileExtensionFilter
Checks if a filename has an extension.
The extension must have at least one more character after the final dot in
the filename, and is usually has three or four characters after the final dot.
Java's class javax.swing.filechooser.FileFilter is abstract and
requires a subclass to define a boolean accept( File ) method and a
getDescription() method. An example of how to create a FileFilter for
image files can be found at
Filtering the List of Files in the sun tutorial pages.
Field Summary | |
---|---|
static String |
DEFAULT_EXTENSION
|
Constructor Summary | |
---|---|
FileExtensionFilter()
Constructs a FileExtensionFilter using the default file extension. |
|
FileExtensionFilter(String extension)
Constructs a FileExtensionFilter. |
Method Summary | |
---|---|
boolean |
accept(File file)
Returns true if the file is a directory or has a ".png" extension. |
String |
getDescription()
Returns a description of the supported file type. |
String |
getFilenameExtension(File file)
Obtains the filename extension (the dot plus the letters after the dot) if it exists and returns it as the dot followed by lowercase letters. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String DEFAULT_EXTENSION
Constructor Detail |
---|
public FileExtensionFilter()
public FileExtensionFilter(String extension)
extension
- the file extension to use.Method Detail |
---|
public String getDescription()
getDescription
in class FileFilter
public boolean accept(File file)
accept
in class FileFilter
file
- the file to test.
public String getFilenameExtension(File file)
file
- the file to get the filename extension from.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |