mirror of https://github.com/dnomd343/mobi-meta
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
671 B
37 lines
671 B
package gui;
|
|
|
|
import java.io.File;
|
|
import java.io.FilenameFilter;
|
|
|
|
import javax.swing.filechooser.FileFilter;
|
|
|
|
class GenericFileFilter extends FileFilter implements FilenameFilter
|
|
{
|
|
public String extension;
|
|
|
|
public String getExtension() {
|
|
return extension;
|
|
}
|
|
|
|
public GenericFileFilter(String extension) {
|
|
this.extension = extension.toLowerCase();
|
|
}
|
|
|
|
public String getDescription()
|
|
{
|
|
return extension;
|
|
}
|
|
|
|
public boolean accept(File f, String name)
|
|
{
|
|
return (accept(f));
|
|
}
|
|
|
|
public boolean accept(File f)
|
|
{
|
|
if (f.isDirectory()) return true;
|
|
|
|
return (f.getName().toLowerCase().endsWith(extension));
|
|
}
|
|
|
|
}
|
|
|