如何使用户仅从指定文件夹中选择文件
int returnVal = fc.showOpenDialog(FileChooser.this);
if (returnVal == JFileChooser.APPROVE_OPTION) {
File file = fc.getSelectedFile();
source = file.getAbsolutePath();
fileName = file.getName();
attachText.setText(fileName);
source = source.replace("\\","\\\\");
}
在这里,我将从任何文件夹中获取文件,我只想从 G:\Project\Attachments 中获取文件。我怎样才能做到这一点?