Package kiyut.citra.io
Class DefaultFileFilter
- java.lang.Object
-
- javax.swing.filechooser.FileFilter
-
- kiyut.citra.io.DefaultFileFilter
-
- Direct Known Subclasses:
ImageFileFilter
public class DefaultFileFilter extends FileFilter
Defaulft File Filter- Author:
- Kiyut
-
-
Field Summary
Fields Modifier and Type Field Description protected Stringdescriptionprotected List<String>filtersprotected StringfullDescriptionprotected static StringHIDDEN_FILEprotected static StringTYPE_UNKNOWNprotected booleanuseExtensionsInDescription
-
Constructor Summary
Constructors Constructor Description DefaultFileFilter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaccept(File f)voidaddExtension(String extension)Adds a filetype "dot" extension to filter against.StringgetDescription()Returns the human readable description of this filter.StringgetExtension(File f)Return the extension portion of the file's name .booleanisExtensionListInDescription()Returns whether the extension list (.jpg, .gif, etc) should show up in the human readable description.voidsetDescription(String description)Sets the human readable description of this filter.voidsetExtensionListInDescription(boolean b)Determines whether the extension list (.jpg, .gif, etc) should show up in the human readable description.
-
-
-
Field Detail
-
TYPE_UNKNOWN
protected static final String TYPE_UNKNOWN
- See Also:
- Constant Field Values
-
HIDDEN_FILE
protected static final String HIDDEN_FILE
- See Also:
- Constant Field Values
-
description
protected String description
-
fullDescription
protected String fullDescription
-
useExtensionsInDescription
protected boolean useExtensionsInDescription
-
-
Method Detail
-
accept
public boolean accept(File f)
- Specified by:
acceptin classFileFilter
-
getExtension
public String getExtension(File f)
Return the extension portion of the file's name .- Parameters:
f- the File- Returns:
- the extension portion of the file's name .
- See Also:
getExtension(java.io.File),accept(java.io.File)
-
addExtension
public void addExtension(String extension)
Adds a filetype "dot" extension to filter against. For example: the following code will create a filter that filters out all files except those that end in ".jpg" and ".tif":ExampleFileFilter filter = new ExampleFileFilter(); filter.addExtension("jpg"); filter.addExtension("tif");Note that the "." before the extension is not needed and will be ignored.- Parameters:
extension- the file extension
-
getDescription
public String getDescription()
Returns the human readable description of this filter. For example: "JPEG and GIF Image Files (*.jpg, *.gif)"- Specified by:
getDescriptionin classFileFilter- Returns:
- description
- See Also:
setDescription(java.lang.String),setExtensionListInDescription(boolean),isExtensionListInDescription()
-
setDescription
public void setDescription(String description)
Sets the human readable description of this filter. For example: filter.setDescription("Gif and JPG Images");- Parameters:
description- the description- See Also:
setDescription(java.lang.String),setExtensionListInDescription(boolean),isExtensionListInDescription()
-
setExtensionListInDescription
public void setExtensionListInDescription(boolean b)
Determines whether the extension list (.jpg, .gif, etc) should show up in the human readable description. Only relevent if a description was provided in the constructor or using setDescription();- Parameters:
b- true or false- See Also:
getDescription(),setDescription(java.lang.String),isExtensionListInDescription()
-
isExtensionListInDescription
public boolean isExtensionListInDescription()
Returns whether the extension list (.jpg, .gif, etc) should show up in the human readable description. Only relevent if a description was provided in the constructor or using setDescription();- Returns:
- true or false
- See Also:
getDescription(),setDescription(java.lang.String),setExtensionListInDescription(boolean)
-
-