Here you can find the source of createFileFilter(final String description, final String[] extensions)
public static FileFilter createFileFilter(final String description, final String[] extensions)
//package com.java2s; import java.io.File; import javax.swing.filechooser.FileFilter; public class Main { public static FileFilter createFileFilter(final String description, final String[] extensions) { return new FileFilter() { @Override//from www . j a va 2 s. com public String getDescription() { return description; } @Override public boolean accept(File f) { if (!f.canRead()) return false; if (f.isDirectory()) return true; String name = f.getName().toLowerCase(); for (String extension : extensions) if (name.endsWith("." + extension.toLowerCase())) return true; return false; } }; } }