Java JFileChooser Filter wrapFilter(final javax.swing.filechooser.FileFilter filter)

Here you can find the source of wrapFilter(final javax.swing.filechooser.FileFilter filter)

Description

Create a javaio FileFilter from the filechooser package file filter.

License

Open Source License

Parameter

Parameter Description
filter The filechooser file filter

Return

The javaio FileFilter.

Declaration

public static java.io.FileFilter wrapFilter(final javax.swing.filechooser.FileFilter filter) 

Method Source Code

//package com.java2s;
/*/*from  w w  w  .j  a v  a2  s.  co m*/
 * Copyright 1997-2016 Unidata Program Center/University Corporation for Atmospheric Research
 * Copyright 2010-2015 Jeff McWhirter
 * 
 * This library is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 2.1 of the License, or (at
 * your option) any later version.
 * 
 * This library 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 Lesser
 * General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with this library; if not, write to the Free Software Foundation,
 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 * 
 */

import java.io.File;

public class Main {
    /**
     * Create a javaio FileFilter from the filechooser package file filter.
     *
     * @param filter The filechooser file filter
     *
     * @return The javaio FileFilter.
     */
    public static java.io.FileFilter wrapFilter(final javax.swing.filechooser.FileFilter filter) {
        return new java.io.FileFilter() {
            public boolean accept(File f) {
                return ((filter == null) ? true : filter.accept(f));
            }
        };

    }
}

Related

  1. listAll(File file, javax.swing.filechooser.FileFilter filter)
  2. makeFileFilter(final String desc, final String... types)
  3. makeFileNameExtensionFilter(String[] extensions)
  4. newFileFilter(final String desc, final String[] allowed_extensions)
  5. validateFileName(final File file, final javax.swing.filechooser.FileFilter filter)