1 package com.instantbank.common.uiutils;
2
3 import javax.swing.filechooser.FileFilter;
4 import java.io.File;
5
6
12 public class SimpleFilter extends javax.swing.filechooser.javax.swing.filechooser.FileFilterdescriptionnull;
13 private String extension = null;
14
15
16
22 public SimpleFilter(String extension, String description) {
23 this.description = description;
24 this.extension = "." + extension.toLowerCase();
25 }
26
27
28
33 public String getDescription() {
34 return description;
35 }
36
37
38
44 public boolean accept(File f) {
45 if(f == null) {
46 return false;
47 }
48 if(f.isDirectory()) {
49 return true;
50 }
51 return f.getName().toLowerCase().endsWith(extension);
52 }
53 }
54