Java GetFile returns incorrect filename after using SetFile
问题 I have some Java code: public static String getSaveFilePath(String title2) { FileDialog fd = new FileDialog(new Frame(), "Save As...", 1); fd.setFilenameFilter(new FilenameFilter() { public boolean accept(File dir, String name) { return name.endsWith(".mp3"); } }); fd.setFile(title2 + ".mp3"); fd.setVisible(true); String str3 = fd.getFile(); String str4 = fd.getDirectory(); if (str4 == null) return null; str3 = str3.replace(".mp3", ""); str3 = str3 + ".mp3"; String str5 = str3; File localFile