int reval = fcCari.showOpenDialog(this);
String sourcePath = fcCari.getSelectedFile().getAbsolutePath();
String targetPath = "C:\\Users\\nadzar\\Downloads\\Compressed\\JavaSQLite\\resource\\";
targetPath += fcCari.getSelectedFile().getName();
if ((reval == JFileChooser.APPROVE_OPTION)) {
File source = new File(sourcePath);
File target = new File(targetPath);
copyFile(source, target);
targetPathFoto=targetPath;
tambahFoto(targetPathFoto);
}
else{
JOptionPane.showMessageDialog(rootPane, "Batal Menambahkan Foto");
tambahFoto(this.targetFoto);
}
System.out.println(targetPathFoto);
如果我的项目已移动,则必须更改路径。我问我的项目目录发生变化时目标路径如何变化?