Java tutorial
//package com.java2s; import java.awt.Component; import java.io.File; import javax.swing.JFileChooser; public class Main { public static File chooseFile(Component parentComponent, String title) { JFileChooser jfc = new JFileChooser(); jfc.setFileSelectionMode(JFileChooser.FILES_ONLY); jfc.showDialog(parentComponent, title); return jfc.getSelectedFile(); } }