Assuming you're determined to use the FileDialog instead of the portable JFileChooser, you need to set the system property so that FileDialogs created are for directories.
The property in question is apple.awt.fileDialogForDirectories
.
So simply do the following:
System.setProperty("apple.awt.fileDialogForDirectories", "true");
FileDialog fd = new FileDialog(this);
fd.setDirectory(_projectsBaseDir.getPath());
fd.setLocation(50,50);
fd.setVisible(true);
File selectedFile = new File(fd.getFile());
System.setProperty("apple.awt.fileDialogForDirectories", "false");
It should be noted that this isn't portable, however, since you're looking to replace the portable JFileDialog, I assume that's not an issue.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…