Extreme Component Documentation

How to use DefaultFileFilter in JComponentPack

May 16,2008

DefaultFileFilter provide a default file filter.

It also provides some useful methods, for example:

getExtensionNames()
Return all extension of this file filter as an array.
getExtensionName ()
Return the extension of the parameter.
It could accept 3 kinds of parameter, a File, a String, an URL.
getNameWithoutExtension(String name)
Returns the file name without extension, for example the file "readme.txt" will return "readme", include the absolute path.
getPreferredExtensionName() 
Returns the preferred extension of this file filter, actually is the first extension of your extensions. It equal this operation getExtensionNames()[0].

It inherits from FileFilter, have two Constructors to create a instance of the FileFilter.

DefaultFileFilter(String ext, String description)
The first parameter is extension, the second parameter is description of extension.
DefaultFileFilter(String[] ext, String description)
The first parameter are extensions, the second parameter is description of extensions.

Subscribe RSS >>download

Send Us Feedback