📄 mydialog3client.java
字号:
package cn.com.chengang.jface.dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
public class MyDialog3Client {
public static void main(String[] args) {
final Display display = Display.getDefault();
final Shell shell = new Shell();
shell.setSize(327, 253);
// ---------创建窗口中的其他界面组件-------------
// 生成一个Human对象
Human human = new Human();
human.setName("陈刚");
human.setOld(80);
human.setSex(true);
MyDialog3 dialog = new MyDialog3(shell);
dialog.setInput(human);
if (dialog.open() == IDialogConstants.OK_ID) {// 是否单击“确定”按钮
Human o = dialog.getInput(); // 取值
if (o == human)
System.out.println("是同一个对象");
System.out.println(o.getName());
System.out.println(o.getOld());
System.out.println(o.isSex());
}
// -----------------END------------------------
shell.dispose();
display.dispose();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -