private java.util.List
private String description;
public ExtensionFileFilter(String[] exts, String desc) {
if(exts != null) {
extensions = new java.util.ArrayList
for(String ext : exts) {
extensions.add(ext.replace(".", "").trim().toLowerCase());
}
}
description = (desc != null) ? desc.trim() : "Some description";
}
@Override
public boolean accept(File f) {
if(extensions == null) return false;
if(f.isDirectory()) return true;
for(String ext : extensions) {
if(f.getName().toLowerCase().endsWith("." + ext)) return true;
}
return false;
}
@Override
public String getDescription() {
return description;
}
}