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 FileDialogSaveDefaultFileName {
public static void main(String[] args) {
Display display = new Display();
final Shell shell = new Shell(display);
FileDialog dlg = new FileDialog(shell, SWT.SAVE);
dlg.setFileName("defaultName");
String fileName = dlg.open();
if (fileName != null) {
System.out.println(fileName);
}
display.dispose();
}
}
|