new FileDialog(Shell parent, int style) (SWT.OPEN)
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Shell;
public class MainClass {
public static void main(String[] a) {
Shell s = new Shell();
FileDialog fd = new FileDialog(s, SWT.OPEN);
fd.setText("Open");
fd.setFilterPath("C:/");
String[] filterExt = {"*.txt","*.doc", ".rtf", "*.*"};
fd.setFilterExtensions(filterExt);
String selected = fd.open();
System.out.println(selected);
}
}
Related examples in the same category