《eclipse_JFace学习——04——SWT->使用基本控件 和 对话框》
一。第四章学习 《基本控件 和 对话框的使用》 P64
final Shell shell = new Shell(display, SWT.NO_TRIM);
//创建一个没有边框的Shell
二. 控件一共分 三类八组
表单控件
(1).Button ,Label, Text
(2).List
(3).combo
菜单 或 工具栏
(4).ToolBar 和 ToolItem
(5).Menu 和MenuItem
(6).CoolBar 和CoolItem
对话框
(7)TabFolder 和 TabItem
(8)对话框
三.
1.Button的种类:
(普通button ,CheckButton ,radio ,toggle) 四种。
2.为Button增加监听
//增加监听的方式,是采用Adapter的方式进行添加的。 既空实现的方式。
//增加选中监听(空实现的 适配器)
button.addSelectionListenter( new SelectionAdapter(){
public void widgetSelected(SelectionEven even){
System.out.print("Push Button Selected");
}
});
上面的代码中,使用了SelectionAdapter类,SelectionAdapter是SelectionListenter的 空实现。
如果,只对 监听器中的某一个方法感兴趣, 开发者就可以继承这个空实现,并重载 只感兴趣 的方法,
而不用实现整个监听器接口来编写所有的方法。 对于拥有多个方法的 监听器接口。 SWT都提供了
类似的空实现,并且以Adapter为名。入MouseLister 接口的空实现 -> MouseAdapter .
posted on 2016-05-15 20:16 fantiejun0436 阅读(159) 评论(0) 收藏 举报
浙公网安备 33010602011771号