Here you can find the source of accept(File f, Collection
Parameter | Description |
---|---|
f | The file to determine whether to accept |
filters | The filtesr to check whether they accept the file |
public static boolean accept(File f, Collection<FileFilter> filters)
//package com.java2s; /*/*from www .j a va 2s . co m*/ * PackJacket - GUI frontend to IzPack to make Java-based installers * Copyright (C) 2008 - 2009 Amandeep Grewal, Manodasan Wignarajah * * PackJacket is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * PackJacket is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with PackJacket. If not, see <http://www.gnu.org/licenses/>. */ import java.io.File; import java.util.Collection; import javax.swing.filechooser.FileFilter; public class Main { /** * Determines whether this file is accepted by the specified collection of filters * @param f The file to determine whether to accept * @param filters The filtesr to check whether they accept the file * @return boolean representation of whether any of the filters accept the file */ public static boolean accept(File f, Collection<FileFilter> filters) { //If there is no filters, or is null true is returned meaning to accept the file if (filters == null || filters.isEmpty()) return true; //Goes through all the fitlers and sees whether any accepts the file, if it does true is returned for (FileFilter filter : filters) if (filter.accept(f)) return true; return false; } }