new DirectoryDialog(Shell shell) : DirectoryDialog « org.eclipse.swt.widgets « Java by API






new DirectoryDialog(Shell shell)


import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

public class MainClass {

  public static void main(String[] a) {
    Display display = new Display();
    final Shell shell = new Shell(display);

    DirectoryDialog dlg = new DirectoryDialog(shell);

    dlg.setFilterPath("c:/");

    dlg.setText("SWT's DirectoryDialog");

    dlg.setMessage("Select a directory");

    String dir = dlg.open();
    if (dir != null) {
      System.out.println(dir);
    }

    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) {
        display.sleep();
      }
    }
    display.dispose();
  }
}

           
       








Related examples in the same category

1.DirectoryDialog: setFilterPath(String path)
2.DirectoryDialog: open()
3.DirectoryDialog: setMessage(String message)