Here you can find the source of findFileOpen(JFrame frame, String ext, String desc)
public static File findFileOpen(JFrame frame, String ext, String desc)
//package com.java2s; //License from project: Open Source License import java.io.*; import javax.swing.*; import javax.swing.filechooser.FileNameExtensionFilter; public class Main { public static File findFileOpen(JFrame frame, String ext, String desc) { JFileChooser chooser = new JFileChooser(); chooser.setFileFilter(new FileNameExtensionFilter(desc, ext)); if (chooser.showOpenDialog(frame) != JFileChooser.APPROVE_OPTION) { return null; }/*from ww w . j a v a2s . c o m*/ return chooser.getSelectedFile(); } }