Java JFileChooser getXmlFileChooser()

Here you can find the source of getXmlFileChooser()

Description

get Xml File Chooser

License

Apache License

Declaration

private static JFileChooser getXmlFileChooser() 

Method Source Code

//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;
    }
}

Related

  1. getSelectedFiles(JFileChooser chooser)
  2. getSelectedFileWithExtension(JFileChooser c)
  3. getSelectedFileWithExtension(JFileChooser c)
  4. getSystemFile(Component owner, int mode, FileFilter[] filters)
  5. getTextFileChooser()
  6. importFile(JFileChooser jFileChooser)
  7. initFileChooser(JFileChooser fileChooser, FileFilter filter)
  8. isDriveTraversable(File drive)
  9. loadFile()