A good understanding of the Java event-handling mechanism is essential for any Java programmer. Event-based Java programming isn’t limited just to GUI Swing programs; you also will find it in applications that use Java technologies such as servlets and message-driven beans.
In his JavaBoutique.com tutorial, Gurunath Kalamadi breaks down the event-handling concept with concise explanations and practical examples. He really brings the lesson home with a novel analogy for event handling: a group of friends deciding what gifts to bring to their friend’s wedding.
Consider four friends: A, B, C and D. Suppose the event is A is getting married. A’s friends, B, C and D, want to respond to this event. The response protocol is to attend the wedding and bring a gift for A. They all must adhere to the response protocol, but they are free to choose the gift they bring.