Here you can find the source of getFileChooserFilter(java.util.List
public static FileNameExtensionFilter getFileChooserFilter(java.util.List<String> allowedExtensions)
//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; } }