我需要从路径浏览文件,即“我的电脑”。我没有将驱动器指定为“c”或“d”。
默认情况下,路径应指向“我的电脑”。
任何开放都可以帮助我。
我们正在使用SWT。
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.open();
DirectoryDialog dialog = new DirectoryDialog(shell);
dialog.setFilterPath(" "); //MyComputer
System.out.println("RESULT=" + dialog.open());
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
答案 0 :(得分:0)
以下将默认选择My Computer
条目。
dialog.setFilterPath("::{20D04FE0-3AEA-1069-A2D8-08002B30309D}");