📄 inputdialog1.java
字号:
package cn.com.chengang.jface.dialog;
import org.eclipse.jface.dialogs.InputDialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
public class InputDialog1 {
public static void main(String[] args) {
final Display display = Display.getDefault();
final Shell shell = new Shell();
shell.setSize(327, 253);
// ---------创建窗口中的其他界面组件-------------
// InputDialog dialog = new InputDialog(shell, "标题", "请输入值", "1", null);
InputDialog dialog = new InputDialog(shell, "标题", "请输入值", "1", new MyValidator());
if (dialog.open() == InputDialog.OK) {
String vlaueStr = dialog.getValue();
System.out.println("输入值:" + vlaueStr);
}
// -----------------END------------------------
// shell.layout();
// shell.open();
shell.dispose();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -