Here you can find the source of getNewFileChooser()
public static JFileChooser getNewFileChooser()
//package com.java2s; //License from project: Open Source License import javax.swing.JFileChooser; import javax.swing.filechooser.FileNameExtensionFilter; public class Main { public static final FileNameExtensionFilter FILE_FILTER_EXCEL = new FileNameExtensionFilter( "Planilhas do Excel (*.xls; *.xlsx)", "xls", "xlsx"); public static final FileNameExtensionFilter FILE_FILTER_CSV = new FileNameExtensionFilter( "Arquivos CSV (*.csv; *.txt)", "csv", "txt"); public static JFileChooser getNewFileChooser() { return getNewFileChooser(FILE_FILTER_EXCEL, FILE_FILTER_CSV); }//from w w w. j a v a 2s . co m public static JFileChooser getNewFileChooser(FileNameExtensionFilter... extensionFilters) { JFileChooser fileChooser = new JFileChooser(System.getProperty("user.dir")); fileChooser.setAcceptAllFileFilterUsed(false); for (FileNameExtensionFilter extensionFilter : extensionFilters) { fileChooser.addChoosableFileFilter(extensionFilter); } return fileChooser; } }