Here you can find the source of createReportFileChooser(String curDir, File defaultReportFile)
public static JFileChooser createReportFileChooser(String curDir, File defaultReportFile)
//package com.java2s; import java.io.*; import javax.swing.JFileChooser; import javax.swing.filechooser.FileFilter; public class Main { public static JFileChooser createReportFileChooser(String curDir, File defaultReportFile) { JFileChooser fc = new JFileChooser(curDir); fc.setFileFilter(new FileFilter() { @Override//from w w w . j a va2s .c om public boolean accept(File f) { String filename = f.getName(); if (filename.endsWith(".html") || filename.endsWith(".htm") || filename.endsWith(".xhtml")) return true; return false; } @Override public String getDescription() { return "HTML file"; } }); if (defaultReportFile != null) fc.setSelectedFile(defaultReportFile); return fc; } }