Here you can find the source of createFileFilter(final String description, String extension)
SwingUtil.createFileFilter("JEQL script (*.jql)", "jql")
Parameter | Description |
---|---|
description | a parameter |
extension | a parameter |
public static FileFilter createFileFilter(final String description, String extension)
//package com.java2s; //License from project: Open Source License import java.io.File; import javax.swing.filechooser.FileFilter; public class Main { /**/*from ww w . j a v a 2s . c om*/ * * Example usage: * <pre> * SwingUtil.createFileFilter("JEQL script (*.jql)", "jql") * </pre> * @param description * @param extension * @return */ public static FileFilter createFileFilter(final String description, String extension) { final String dotExt = extension.startsWith(".") ? extension : "." + extension; FileFilter ff = new FileFilter() { public String getDescription() { return description; } public boolean accept(File f) { return f.isDirectory() || f.toString().toLowerCase().endsWith(dotExt); } }; return ff; } }