文件对话框对应的类型:FileDialog
创建时有三种样式可以选择:SAVE,OPEN和MULTI
- FileDialog fileDialog= new FileDialog(shell,SWT.SAVE);
- fileDialog.open();
文件过滤:
fileDialog.setFilterNames(new String[]{”Text Files”,”Both Files”,”All Files”});
fileDialog.setFilterExtensions(new String[]{”*.txt”,”*.exe”,”*.*”});
打开目录
- DirectoryDialog dirDialog = new DirectoryDialog(shell);
- dirDialog.setFilterPath("d:\\");
- System.out.println(dirDialog.open());//打开对话框并打印用户选择的目录
分类: eclipse, eclipse RCP, eclipse使用技巧 |