0
JFileChooser dialog = new JFileChooser();
dialog.showOpenDialog(rootPane);
dialog.setMultiSelectionEnabled(true);
dialog.setFileFilter(new FileFilter() {
@Override
public String getDescription() {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean accept(File arg0) {
return arg0.getAbsolutePath().endsWith("png")||
arg0.getAbsolutePath().endsWith("jpg");
}
});
File[] file = dialog.getSelectedFiles();
當程序運行時,我不能選擇超過1個文件。
請創建併發佈一個小而簡單的完整程序來說明您的問題,[MCVE](http://stackoverflow.com/help/mcve)。請檢查鏈接瞭解這個非常有用的工具的詳細信息。 –