计算机专业外文翻译---事件处理基础
《计算机专业外文翻译---事件处理基础》由会员分享,可在线阅读,更多相关《计算机专业外文翻译---事件处理基础(19页珍藏版)》请在毕设资料网上搜索。
1、 1 外文原文 Basics of Event Handling 出处 :Thinking in java 作者 : Bruce Eckel Any operating environment that supports GUIs constantly monitors events such as keystrokes or mouse clicks. The operating environment reports these events to the programs that are running. Each program then decides what, if anyth
2、ing, to do in response to these events. In languages like Visual Basic, the correspondence between events and code is obvious. One writes code for each specific event of interest and places the code in what is usually called an event procedure. For example, a Visual Basic button named HelpButton wou
3、ld have a Help Button_Click event procedure associated with it. The code in this procedure executes whenever that button is clicked. Each Visual Basic GUI component responds to a fixed set of events, and it is impossible to change the events to which a Visual Basic component responds. On the other h
4、and, if you use a language like raw C to do event-driven programming, you need to write the code that constantly checks the event queue for what the operating environment is reporting. This technique is obviously rather ugly, and, in any case, it is much more difficult to code. The advantage is that
5、 the events you can respond to are not as limited as in languages, like Visual Basic, that go to great lengths to hide the event queue from the programmer. The Java programming environment takes an approach somewhat between the Visual Basic approach and the raw C approach in terms of power and, ther
6、efore, in resulting complexity. Within the limits of the events that the AWT knows about, you completely control how events are transmitted from the event sources (such as buttons or scrollbars) to event listeners. You can designate any object to be an event listener in practice, you pick an object
7、that can conveniently carry out the desired response to the event. This event delegation model gives you much more flexibility than is possible with Visual Basic, in which the listener is predetermined, but it requires more code and is more difficult to untangle (at least until you get used to it).
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中设计图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 计算机专业 外文 翻译 事件 处理 基础
