Inheritance-Based Mechanism

Under certain circumstances, an inheritance-based event handling mechanism may be preferable to delegation. For instance, if a class provides some fundamental functionality that is tied to a particular event, an inheritance-based approach might possibly be preferred. The JDK documentation for the event model stresses that the inheritance-based mechanism is to be used sparingly, if at all.

The JDK delegation event model provides an inheritance-based alternative to using delegation for event handling. The inheritance-based mechanism is based upon the original JDK event model and suffers from its shortcomings; as a result, we reiterate the documentation warning: the inheritance-based mechanism should be used sparingly, ...

Get Graphic Java™ 1.2, Volume I: AWT, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.