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