Java JFileChooser Filter getFileFilter( String text, String... formats)

Here you can find the source of getFileFilter( String text, String... formats)

Description

get File Filter

License

Open Source License

Declaration

private static javax.swing.filechooser.FileFilter getFileFilter(
            String text, String... formats) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.*;

public class Main {
    private static Map<String, javax.swing.filechooser.FileFilter> fmt2FileFilter = null;

    private static javax.swing.filechooser.FileFilter getFileFilter(
            String text, String... formats) {
        javax.swing.filechooser.FileFilter rv = null;
        if (formats != null) {
            if (formats.length > 0) {
                if (fmt2FileFilter == null) {
                    fmt2FileFilter = new Hashtable<String, javax.swing.filechooser.FileFilter>();
                }//from   www.  j  a va 2 s  . c  om
                rv = fmt2FileFilter.get(formats[0]);
                if (rv == null) {
                    rv = new javax.swing.filechooser.FileNameExtensionFilter(
                            text, formats);
                    fmt2FileFilter.put(formats[0], rv);
                }
            }
        }
        return rv;
    }
}

Related

  1. fileEndsInValidExtension(File file, FileNameExtensionFilter filter)
  2. fileNameAutoExtend(FileFilter filter, File file)
  3. getBinaryFileFilter()
  4. getCustomFileFilter(String desc, String[] validExtensions)
  5. getFileChooserFilter(java.util.List allowedExtensions)
  6. getFileFilter()
  7. getFileFilterForExtensions(final String[] exts, final boolean ignoreCase)
  8. getFilterExtensions(FileNameExtensionFilter... filters)
  9. getHostFileFilters()