|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjavax.swing.filechooser.FileFilter
org.jorion.util.MyFileNameExtensionFilter
public final class MyFileNameExtensionFilter
An implementation of FileFilter that filters using a specified set of extensions. The extension for a file is
the portion of the file name after the last ".". Files whose name does not contain a "." have no file name extension.
File name extension comparisons are case insensitive.
The following example creates a FileNameExtensionFilter that will show jpg files:
FileFilter filter = new FileNameExtensionFilter("JPEG file", "jpg", "jpeg");
JFileChooser fileChooser = ...;
fileChooser.addChoosableFileFilter(filter);
FileFilter,
JFileChooser.setFileFilter(javax.swing.filechooser.FileFilter),
JFileChooser.addChoosableFileFilter(javax.swing.filechooser.FileFilter),
JFileChooser.getFileFilter()| Constructor Summary | |
|---|---|
MyFileNameExtensionFilter(java.lang.String description,
java.lang.String... extensions)
Creates a FileNameExtensionFilter with the specified description and file name extensions. |
|
| Method Summary | |
|---|---|
boolean |
accept(java.io.File f)
Tests the specified file, returning true if the file is accepted, false otherwise. |
java.lang.String |
getDescription()
The description of this filter. |
java.lang.String[] |
getExtensions()
Returns the set of file name extensions files are tested against. |
java.lang.String |
toString()
Returns a string representation of the FileNameExtensionFilter. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public MyFileNameExtensionFilter(java.lang.String description,
java.lang.String... extensions)
FileNameExtensionFilter with the specified description and file name extensions. The returned
FileNameExtensionFilter will accept all directories and any file with a file name extension contained in
extensions.
description - textual description for the filter, may be nullextensions - the accepted file name extensionsaccept(java.io.File)| Method Detail |
|---|
public boolean accept(java.io.File f)
FileFilter, or the file is a directory.
accept in class javax.swing.filechooser.FileFilterf - the File to test
public java.lang.String getDescription()
getDescription in class javax.swing.filechooser.FileFilterpublic java.lang.String[] getExtensions()
public java.lang.String toString()
FileNameExtensionFilter. This method is intended to be used for
debugging purposes, and the content and format of the returned string may vary between implementations.
toString in class java.lang.ObjectFileNameExtensionFilter
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||