1 44 package org.jfree.ui; 45 46 import java.io.File ; 47 48 import javax.swing.filechooser.FileFilter ; 49 50 55 public class ExtensionFileFilter extends FileFilter { 56 57 58 private String description; 59 60 61 private String extension; 62 63 69 public ExtensionFileFilter(final String description, final String extension) { 70 this.description = description; 71 this.extension = extension; 72 } 73 74 81 public boolean accept(final File file) { 82 83 if (file.isDirectory()) { 84 return true; 85 } 86 87 final String name = file.getName().toLowerCase(); 88 if (name.endsWith(this.extension)) { 89 return true; 90 } 91 else { 92 return false; 93 } 94 95 } 96 97 102 public String getDescription() { 103 return this.description; 104 } 105 106 } 107 | Popular Tags |