下面给出AWT事件处理机制的概要: 监听器对象是一个实现了特定监听器接口(listener interface)的类的实例。 事件源是一个能够注册监听器对象并传送事件对象的对象。
基于1个网页-相关网页
Listing 5. An example listener interface.
清单5 . listener接口示例。
If you want to know the value of the attribute, you must register a listener object that implements the StorageServiceListener interface.
如果希望知道属性的值,必须注册一个实现StorageServiceListener接口的侦听器对象。
Next, the client, who is also a Listener because it implements the Listener interface, must register with the Speaker and pass in a reference to their Listener interface.
接着,客户机(即Listener,因为它实现Listener接口)必须注册到Speaker,并将引用传给Listener接口。
应用推荐