王吉元-NWPU

导航

 

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);

 

posted on 2013-09-12 20:12  王吉元  阅读(1732)  评论(0编辑  收藏  举报