Java JFileChooser Filter getFileChooserFilter(java.util.List allowedExtensions)

Here you can find the source of getFileChooserFilter(java.util.List allowedExtensions)

Description

get File Chooser Filter

License

Open Source License

Declaration

public static FileNameExtensionFilter getFileChooserFilter(java.util.List<String> allowedExtensions) 

Method Source Code

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

import javax.swing.filechooser.FileNameExtensionFilter;

public class Main {
    public static FileNameExtensionFilter getFileChooserFilter(java.util.List<String> allowedExtensions) {
        String extensionsMsg = "";
        int numExtensions = allowedExtensions.size();
        String[] allowedFileExtensions = new String[numExtensions];
        for (int i = 0; i < numExtensions; i++) {
            if (i > 0)
                extensionsMsg += ", ";
            allowedFileExtensions[i] = allowedExtensions.get(i);
            extensionsMsg += "*." + allowedFileExtensions[i];
        }/*from   w  w  w. j  av a  2s . c  o m*/
        FileNameExtensionFilter filter = new FileNameExtensionFilter(extensionsMsg, allowedFileExtensions);
        return filter;
    }
}

Related

  1. createFileFilter(String text, String[]... suffixes)
  2. fileEndsInValidExtension(File file, FileNameExtensionFilter filter)
  3. fileNameAutoExtend(FileFilter filter, File file)
  4. getBinaryFileFilter()
  5. getCustomFileFilter(String desc, String[] validExtensions)
  6. getFileFilter( String text, String... formats)
  7. getFileFilter()
  8. getFileFilterForExtensions(final String[] exts, final boolean ignoreCase)
  9. getFilterExtensions(FileNameExtensionFilter... filters)