1 21 package proguard.gui; 22 23 import java.io.File ; 24 import javax.swing.filechooser.FileFilter ; 25 26 27 33 class ExtensionFileFilter extends FileFilter 34 { 35 private String description; 36 private String [] extensions; 37 38 39 44 public ExtensionFileFilter(String description, String [] extensions) 45 { 46 this.description = description; 47 this.extensions = extensions; 48 } 49 50 51 53 public String getDescription() 54 { 55 return description; 56 } 57 58 59 public boolean accept(File file) 60 { 61 if (file.isDirectory()) 62 { 63 return true; 64 } 65 66 String fileName = file.getName().toLowerCase(); 67 68 for (int index = 0; index < extensions.length; index++) 69 { 70 if (fileName.endsWith(extensions[index])) 71 { 72 return true; 73 } 74 } 75 76 return false; 77 } 78 } 79 | Popular Tags |