定义默认Button
来源:互联网 发布:大型网络交换机 编辑:程序博客网 时间:2024/05/16 18:07
import org.eclipse.swt.*;
import org.eclipse.swt.widgets.*;
import org.eclipse.swt.events.*;
import org.eclipse.swt.layout.*;
public class Snippet164 {
public static void main (String [] args) {
Display display = new Display ();
Shell shell = new Shell (display);
Label label = new Label (shell, SWT.NONE);
label.setText ("Enter your name:");
Text text = new Text (shell, SWT.BORDER);
text.setLayoutData (new RowData (100, SWT.DEFAULT));
Button ok = new Button (shell, SWT.PUSH);
ok.setText ("OK");
ok.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
System.out.println("OK");
}
});
Button cancel = new Button (shell, SWT.PUSH);
cancel.setText ("Cancel");
cancel.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
System.out.println("Cancel");
}
});
//定义默认Button
shell.setDefaultButton (cancel);
shell.setLayout (new RowLayout ());
shell.pack ();
shell.open ();
while (!shell.isDisposed ()) {
if (!display.readAndDispatch ()) display.sleep ();
}
display.dispose ();
}
}
- 定义默认Button
- button reset 功能定义
- Button 按钮设置默认焦点
- Button中默认的padding
- button 默认类型是submit
- 关于button的默认类型
- 去掉Button的默认背景
- 去掉button ios默认样式
- 定义Button事件时报错
- wpf中button样式定义
- 定义界面布局TextView&Button
- 【转载】css定义button样式
- html button 标签 -- 定义按钮
- 定义默认参数
- 默认参数重定义
- Remove Button default Margin / 删除Button默认的Margin
- 给input的button 应用默认样式
- MFC radio button 设置默认选中
- 一份软件项目的失败报告
- 学习全选和快捷键
- 男人的品位在于选择妻子
- 不顾一切要成功:成功人士的大智慧
- 密码用“*”代替
- 定义默认Button
- 打开文件
- 复制和粘贴
- 如何让你的共享软件成为印钞机-最新内幕大暴光
- 保存文件
- #pragma 预处理指令详解
- Knix的Linux
- 人气最旺论坛
- 到美国去,挣美元!