/ Published in: Java
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
import javax.swing.filechooser.FileFilter; import java.io.File; private boolean acceptDirs = true; this.ext = ext; this.desc = ext + "-Files (" + generateExtensionString(ext) + ")"; } this.ext = ext; this.desc = desc + " (" + generateExtensionString(ext) + ")"; } return desc; } if (f.isDirectory() && acceptDirs) { return true; } if (!isMultiExtensionString(ext)) { return f.getName().endsWith(ext); } for (int i = 0; i < exts.length; i++) { if (f.getName().endsWith(exts[i])) { return true; } } return false; } return ext.indexOf(',') >= 0; } for (int i = 0; i < exts.length; i++) { sb.append("*."); sb.append(exts[i]); if (i != exts.length - 1) { sb.append(","); } } return sb.toString(); } }