EventHandler is a delegate for a function that takes an Object (the sender) and eventargs.
这里EventHandler是某个函数的委托,该函数带有参数:Object(也就是sender)和eventargs。
This latter feature of using EventHandler is less of an issue with the other versions of create .
使用EventHandler的另一个特点是对于其他版本的create来说,很少出现问题。
Listing 3 duplicates the earlier button selection example shown in Figure 1, using an EventHandler.
清单3重复了前面图1中的按钮选择例子,使用了一个EventHandler。
It would be even more object oriented if you replaced the last bits of the if statement with a Map connecting EventTypes to EventHandler factory objects.
要想进一步增强面向对象特性,可以将if语句的最后一小部分替换为Map,后者将EventType连接到EventHandler工厂对象。
Instead of creating a class that implements an interface and registering that implementation with the component whose event you are interested in, you create an EventHandler instance and register it.
它不是创建一个实现了接口的类、并将这个实现注册到需要监听的事件所在的组件上,而是创建一个EventHandler实例并注册它。
Instead of creating a class that implements an interface and registering that implementation with the component whose event you are interested in, you create an EventHandler instance and register it.
它不是创建一个实现了接口的类、并将这个实现注册到需要监听的事件所在的组件上,而是创建一个EventHandler实例并注册它。
应用推荐