/**
*
*/
package common_function;
import java.io.File;
import javax.swing.JFileChooser;
/**
* @author songdapengcc
*
*/
public class CommonFunction
{
public static String[] selectPath(String fileName)
{
JFileChooser chooser = new JFileChooser();
chooser.setCurrentDirectory(new File(fileName));// 正确的为"C://Documents
chooser.setMultiSelectionEnabled(true);// setMultiSelectionEnabled(true);
int returnVal = chooser.showOpenDialog(null);// showOpenDialog(this);
String[] fullPath_global = null;// new String();
if(returnVal == JFileChooser.APPROVE_OPTION)
{
// fullPath = chooser.getSelectedFile().getPath();
File[] file = chooser.getSelectedFiles();
String[] fullPath = new String[file.length];
fullPath_global = fullPath;
for(int i = 0; i < file.length; i++)
{
fullPath[i] = file[i].getPath();
}
}
return fullPath_global;
}
}