问题描述
我正在尝试添加一个小山文件图像和一个大山文件图像,由于某种原因,它们全部复制到一个路径中,这是我的代码 MountainListView.setonmousepressed(new EventHandler() {
@Override
public void handle(MouseEvent mouseEvent) {
if (mouseEvent.getButton().equals(MouseButton.PRIMARY)) {
if (mouseEvent.getClickCount() == 2) {
FileChooser fileChooser = new FileChooser();
Window stage = null;
fileChooser.showOpenDialog(stage);
List<File> list = fileChooser.showOpenMultipleDialog(stage);
String path1 = "C:\\Users\\Dan\\eclipse-workspace\\mountainviewer\\src\\images\\small\\";
String path2 = "C:\\Users\\Dan\\eclipse-workspace\\mountainviewer\\src\\images\\large\\";
if (list != null) {
for (int i = 0; i < list.size(); i++) {
File file = list.get(i);
try {
if (i == 0) {
Files.copy(file.toPath(),(new File(path1 + file.getName())).toPath(),StandardcopyOption.REPLACE_EXISTING);
}
} catch (IOException e) {
// Todo Auto-generated catch block
e.printstacktrace();
}
};
}
}
}
}
});
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)