new FileDialog(Shell parent, int style) (SWT.OPEN) : FileDialog « org.eclipse.swt.widgets « Java by API






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

1.new FileDialog(Shell parent, int style) (SWT.SAVE)
2.FileDialog: open()
3.FileDialog: setFilterExtensions(String[] filters)
4.FileDialog: setFilterPath(String path)