引进无类型事件监听 : SWT事件 « SWT « Java 教程

En
Java 教程
1. 语言基础
2. 数据类型
3. 操作符
4. 流程控制
5. 类定义
6. 开发相关
7. 反射
8. 正则表达式
9. 集合
10. 线
11. 文件
12. 泛型
13. 本土化
14. Swing
15. Swing事件
16. 二维图形
17. SWT
18. SWT 二维图形
19. 网络
20. 数据库
21. Hibernate
22. JPA
23. JSP
24. JSTL
25. Servlet
26. Web服务SOA
27. EJB3
28. Spring
29. PDF
30. 电子邮件
31. 基于J2ME
32. J2EE应用
33. XML
34. 设计模式
35. 日志
36. 安全
37. Apache工具
38. 蚂蚁编译
39. JUnit单元测试
Java
Java 教程 » SWT » SWT事件 
17. 89. 6. 引进无类型事件监听
  1. The untyped listener interface is represented by the Listener interface
  2. It contains one method: void handleEvent(Event event)

Event Members

MemberDescription
int buttonThe one-based index of the button that was clicked or released.
char characterThe character that was typed.
int countThe number of pending paint events.
Object dataApplication-specific data.
int detailA detail constant from the SWT class that contains details about the event.
Display displayThe display where the event occurred.
boolean doitA flag indicating whether to process this event. Not supported for all events.
int endThe end of the range of modified text.
GC gcThe graphics context associated with this event.
int heightThe height in pixels of the rectangle that needs painting.
Widget itemThe widget where the event occurred.
int keyCodeThe key code of the key that was typed.
int startThe beginning of the range of modified text.
int stateMaskThe mask describing the state of the modifier keys at the time of the event.
String textThe text to insert.
int timeThe event's time.
int typeThe type of the event. This is the field to switch on to handle the various event types.
Widget widgetThe widget that issued the event.
int widthThe width in pixels of the rectangle that needs painting.
int xEither the x offset of the rectangle that needs painting or the x coordinate of the mouse pointer at the time of the event, depending n the event.
int yEither the y offset of the rectangle that needs painting or the y coordinate of the mouse pointer at the time of the event, depending on the event.


To add an untyped listener to a widget, call addListener() on it.

void addListener(int eventType, Listener listener)

eventType contains one of the event type constants from the SWT class:

TypeDescription
SWT.ActivateTriggered when the widget becomes the active window
SWT.ArmTriggered when the widget is armed
SWT.CloseTriggered when the widget is closed
SWT.CollapseTriggered when a tree node is collapsed
SWT.DeactivateTriggered when the widget is no longer the active window
SWT.DefaultSelectionTriggered when the default selection occurs
SWT.DeiconifyTriggered when the widget is restored from being minimized
SWT.DisposeTriggered when the widget is disposed
SWT.DragDetectTriggered when the widget is dragged
SWT.ExpandTriggered when a tree node is expanded
SWT.FocusInTriggered when the widget gains focus
SWT.FocusOutTriggered when the widget loses focus
SWT.HardKeyDownTriggered when a special hardware key, such as on a Pocket PC device, is pressed
SWT.HardKeyUpTriggered when a special hardware key, such as on a Pocket PC device, is released
SWT.HelpTriggered when the user requests help
SWT.HideTriggered when the widget is hidden
SWT.IconifyTriggered when the widget is minimized
SWT.KeyDownTriggered when the user presses a key
SWT.KeyUpTriggered when the user releases a key
SWT.MenuDetectTriggered when a menu is selected
SWT.ModifyTriggered when the text of a widget is modified
SWT.MouseDoubleClickTriggered when the mouse is double-clicked
SWT.MouseDownTriggered when the mouse button is clicked
SWT.MouseEnterTriggered when the mouse pointer enters the widget
SWT.MouseExitTriggered when the mouse pointer exits the widget
SWT.MouseHoverTriggered when the mouse pointer hovers over the widget
SWT.MouseMoveTriggered when the mouse pointer moves through the widget
SWT.MouseUpTriggered when the mouse button is released
SWT.MoveTriggered when the widget is moved
SWT.NoneNull event
SWT.PaintTriggered when the widget is painted
SWT.ResizeTriggered when the widget is resized
SWT.SelectionTriggered when the widget is selected
SWT.ShowTriggered when the widget is shown
SWT.TraverseTriggered when the user tabs through the controls
SWT.VerifyTriggered when the text for the widget is about to change, allowing you to veto the change


17. 89. SWT事件
17. 89. 1. 事件
17. 89. 2. 事件模型事件模型
17. 89. 3. 事件通知程序事件通知程序
17. 89. 4. SWT provides two kinds of event listening mechanism: typed and untyped.SWT provides two kinds of event listening mechanism: typed and untyped.
17. 89. 5. 无类型的事件和无类型事件监听无类型的事件和无类型事件监听
17. 89. 6. 引进无类型事件监听
17. 89. 7. 获取事件类型获取事件类型
17. 89. 8. 执行一般事件监听执行一般事件监听
17. 89. 9. 引进类型事件听众
17. 89. 10. 类型事件监听
17. 89. 11. SWT信息键和值
17. 89. 12. 使用SelectionListener使用SelectionListener
17. 89. 13. 添加窗口调整事件监听添加窗口调整事件监听
17. 89. 14. 添加addPaintListener到复合框添加addPaintListener到复合框
17. 89. 15. 添加默认选择事件监听组合框添加默认选择事件监听组合框
17. 89. 16. 使用HelpListener使用HelpListener
17. 89. 17. Demonstrate DisposeListener which is notified on the associated widget's disposal
17. 89. 18. 使用ControlListener使用ControlListener
17. 89. 19. 使用FocusListener使用FocusListener
17. 89. 20. 使用VerifyListener使用VerifyListener
17. 89. 21. 使用ModifyListener使用ModifyListener
17. 89. 22. 添加AccessibleListener添加AccessibleListener
17. 89. 23. 添加AccessibleControlListener添加AccessibleControlListener
17. 89. 24. 新增和移除过滤器事件监听新增和移除过滤器事件监听
www.java2java.com | Contact Us
Copyright 2010 - 2030 Java Source and Support. All rights reserved.
All other trademarks are property of their respective owners.