Dienstag, 18. November 2008

EE3206 Java Event Handling

EE3206 Java Programming

Event Handling-- from Savitch 's Absolute Java (p.931)

1. Clicking a button with your mouse creates an object known as an event and sends the event object to another object known as the listeners. This is called firing the event.

2. The listener then performs some action. When we say that the event is "sent" to the listener object, what we really mean is that some method in the listeners object is invoked with event object as the argument.

3. For each button, it needs to specify what objects are listeners that will respond to events fired by that button; this is called registering the listener.

4. Different kinds of components require different kinds of listeners classes to handle the events they fire. A button fires events known as action events, which are handled by listeners known as action listeners.



Keine Kommentare: