java swing 选择文件夹对话框
import java.io.File;import javax.swing.JFileChooser;public class Test2 { public static void main(String[] args) { JFileChooser jf = new JFileChooser(); jf.setSelectedFile(new File("c:\\我的报表.xls")); int value = jf.showSaveDialog(null); jf.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); jf.setFileHidingEnabled(false); if (value == JFileChooser.APPROVE_OPTION) { File getPath = jf.getSelectedFile(); // TODO } else { // TODO } }}