Here you can find the source of getXmlFileChooser()
private static JFileChooser getXmlFileChooser()
//package com.java2s; //License from project: Apache License import java.io.*; import javax.swing.*; import javax.swing.filechooser.FileFilter; public class Main { private static JFileChooser getXmlFileChooser() { JFileChooser xmlFileChooser = new JFileChooser(); // Create a filter for .xml files FileFilter filter = new FileFilter() { public boolean accept(File file) { if (file.isDirectory()) return true; String name = file.getName().toLowerCase(); return name.endsWith(".xml"); }// w w w .j a v a 2 s . c om public String getDescription() { return "XML"; } }; xmlFileChooser.setFileFilter(filter); return xmlFileChooser; } }