DEVFYI - Developer Resource - FYI

What is the difference between the JDK 1.02 event model and the event-delegation model introduced with JDK 1.1?

Java Interview Questions and Answers (part 2)


(Continued from previous question...)

307. What is the difference between the JDK 1.02 event model and the event-delegation model introduced with JDK 1.1?

The JDK 1.02 event model uses an event inheritance or bubbling approach. In this model, components are required to handle their own events. If they do not handle a particular event, the event is inherited by (or bubbled up to) the component's container. The container then either handles the event or it is bubbled up to its container and so on, until the highest-level container has been tried. In the event-delegation model, specific objects are designated as event handlers for GUI components. These objects implement event-listener interfaces. The event-delegation model is more efficient than the event-inheritance model because it eliminates the processing required to support the bubbling of unhandled events.

(Continued on next question...)

Other Interview Questions