Java JFileChooser Filter getBinaryFileFilter()

Here you can find the source of getBinaryFileFilter()

Description

get Binary File Filter

License

Open Source License

Declaration

public static javax.swing.filechooser.FileFilter getBinaryFileFilter() 

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;

    public static javax.swing.filechooser.FileFilter getBinaryFileFilter() {
        return getFileFilter("Einfache Speicherabbilddateien (*.bin)",
                "bin");
    }/*from w  ww  .  j  av  a 2s  . c om*/

    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>();
                }
                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. createFileFilter(final String filter)
  2. createFileFilter(final String filterName, final String... extensionPatterns)
  3. createFileFilter(String text, String[]... suffixes)
  4. fileEndsInValidExtension(File file, FileNameExtensionFilter filter)
  5. fileNameAutoExtend(FileFilter filter, File file)
  6. getCustomFileFilter(String desc, String[] validExtensions)
  7. getFileChooserFilter(java.util.List allowedExtensions)
  8. getFileFilter( String text, String... formats)
  9. getFileFilter()