import org.eclipse.swt.*;
import org.eclipse.swt.widgets.*;
public class Snippet164 {
public static void main (String [] args) {
Display display = new Display ();
Shell shell = new Shell (display);
//打开文件
FileDialog dialog = new FileDialog (shell, SWT.OPEN);
dialog.setText ("Open an file or cancel");
dialog.open();
while (!shell.isDisposed ()) {
if (!display.readAndDispatch ()) display.sleep ();
}
display.dispose ();
}
}