资料选择器只选路径的方法[转]

文件选择器只选路径的方法[转]http://thoughtfly.iteye.com/blog/509022??可以用JFileChooser来选择,其DIR

文件选择器只选路径的方法[转]

http://thoughtfly.iteye.com/blog/509022

?

?

可以用JFileChooser来选择,其DIRECTORIES_ONLY为只显示路径。

?

javax.swing.JFileChooser chooser = new javax.swing.JFileChooser(filePath);            //只是用于目录选择             chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);          int returnVal = chooser.showOpenDialog(this);        if (returnVal == javax.swing.JFileChooser.APPROVE_OPTION) {             valueField.setText(chooser.getSelectedFile().getAbsolutePath());         } 
?