分析了观察者(Observer)设计模式的各组成部分和应用场景,探讨了Java事件处理机制的原理以及事件源、事件、监听器与观察者设计模式中各角色的对应关系,给出了利用观察者模式实现Java事件处理机制的三种方式并分析了各自的优缺点.%Analyzed the composition of each part of the Observer design pattern and its application scenarios,explored the correspondence between Java event handling mechanism of principle as well as the source of event,event,event listener with the Observer design pattern role.Given three ways of the use of Observer mode to achieve the mechanism of the Java event handling and analyzed their respective advantages and disadvantages.
展开▼