首先,用户使用仅限于 .zip 扩展名的 JFileChooser 浏览包含其 Java 项目的 zip 文件。
然后我希望将所有文件路径作为字符串存储在数组中。
浏览...按钮:
btnBrowse.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
int returnVal = fileChooser.showOpenDialog(null);
if (returnVal == JFileChooser.APPROVE_OPTION) {
File zip = fileChooser.getSelectedFile();
// This is where the I need help.
}
}
});
所以我的数组将是这样的:
[path\to\java\file, path\to\java\file, path\to\java\file, path\to\java\file]
有人可以帮我吗?