import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Shell;
public class FileDialogOpenSelectedName {
public static void main(String[] args) {
Display display = new Display();
final Shell shell = new Shell(display);
FileDialog dlg = new FileDialog(shell, SWT.OPEN);
String fileName = dlg.open();
if (fileName != null) {
System.out.println(fileName);
}
display.dispose();
}
}
|