org.eclipse.swt.widgets.DirectoryDialog//选择目录
org.eclipse.swt.widgets.FileDialog//SWT.OPEN打开文件 SWT.SAVE保存文件
选择文件:
FileDialog fileselect=new FileDialog(shell); fileselect.setFilterNames(new String[]{"*.*","所有文件"}); fileselect.setFilterExtensions(new String[]{"*.*","*.*"}); String url=""; url=fileselect.open(); System.out.println(url);
选择文件夹:
DirectoryDialog fileselect = new DirectoryDialog(shell); fileselect.setFilterNames(new String[]{"*.*","所有文件"}); fileselect.setFilterExtensions(new String[]{"*.*","*.*"}); String url=""; url=fileselect.open(); System.out.println(url);