Package info.monitorenter.gui.chart.io
Class FileFilterExtensions
java.lang.Object
javax.swing.filechooser.FileFilter
info.monitorenter.gui.chart.io.FileFilterExtensions
- All Implemented Interfaces:
INameFilter
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.
Example usage:
...
JFileChooser fileChooser = new JFileChooser();
FileFilter soundFileFilter = new FileFilterExtensions(new String[]{"wav","mp3"});
fileChooser.setFileFilter(soundFileFilter);
...
- Author:
- invalid input: '<'a href="mailto:Achim.Westermann@gmx.de>Achim Westermann
-
Constructor Summary
ConstructorsConstructorDescriptionFileFilterExtensions
(String[] extensionsWithoutDot) Creates an instance that will accept files with the given extensions. -
Method Summary
-
Constructor Details
-
FileFilterExtensions
Creates an instance that will accept files with the given extensions.- Parameters:
extensionsWithoutDot
- A String[] containing extension strings without the dot like: .new String[]{"bat","txt","dict"}
- Throws:
IllegalArgumentException
- if the given extensions are inivalid.
-
-
Method Details
-
accept
- Specified by:
accept
in classFileFilter
- See Also:
-
accept
Description copied from interface:INameFilter
Accept the file denoted by the given url String.- Specified by:
accept
in interfaceINameFilter
- Parameters:
urlstring
- a String in url format denoting a file.- Returns:
- true if the file denoted by the given url String is accepted.
- See Also:
-
getDescription
- Specified by:
getDescription
in classFileFilter
- See Also:
-