Java by API/org.eclipse.swt.widgets/DirectoryDialog
Содержание
DirectoryDialog: open()
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();
}
}
DirectoryDialog: setFilterPath(String path)
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();
}
}
DirectoryDialog: setMessage(String message)
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();
}
}
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();
}
}