|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.swing.filechooser.FileFilter
info.monitorenter.gui.chart.io.FileFilterExtensions
public final class FileFilterExtensions
Configureable implementation of FileFilter
that filters files by their extension (e.g.: ".txt").
The extension Strings are provided to the constructor (no configuration of initialized instance provided yet) and have to be the sole extension without the dot.
This class is most often used to configure JFileChooser
dialogs. Therefore it accepts all directories to allow browsing.
...
JFileChooser fileChooser = new JFileChooser();
FileFilter soundFileFilter = new FileFilterExtensions(new String[]{"wav","mp3"});
fileChooser.setFileFilter(soundFileFilter);
...
Constructor Summary | |
---|---|
FileFilterExtensions(java.lang.String[] extensionsWithoutDot)
Creates an instance that will accept files with the given extensions. |
Method Summary | |
---|---|
boolean |
accept(java.io.File pathname)
|
boolean |
accept(java.lang.String urlstring)
Accept the file denoted by the given url String. |
java.lang.String |
getDescription()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FileFilterExtensions(java.lang.String[] extensionsWithoutDot) throws java.lang.IllegalArgumentException
extensionsWithoutDot
- A String[] containing extension strings without the dot like:
new String[]{"bat","txt","dict"}
java.lang.IllegalArgumentException
- if the given extensions are inivalid.Method Detail |
---|
public boolean accept(java.io.File pathname)
accept
in class javax.swing.filechooser.FileFilter
FileFilter.accept(java.io.File)
public boolean accept(java.lang.String urlstring)
INameFilter
accept
in interface INameFilter
urlstring
- a String in url format denoting a file.
INameFilter.accept(String)
public java.lang.String getDescription()
getDescription
in class javax.swing.filechooser.FileFilter
FileFilter.getDescription()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |