Explain how two components can be set up to share the same listener. How can the listener tell which component generated the event?

What will be an ideal response?

Two different components may generate the same type of event. For example, a push button and a text field both generate an action event. Therefore, the same listener object can be added to both components. When the event occurs, the component that generates the event calls the listener method. The getSource method of the event object returns a reference to the generating component.

Computer Science & Information Technology

You might also like to view...

Identify the expression used to reference a prototype.

A. objInstance.prototype B. objClass.prototype C. objName.prototype D. objMethod.prototype

Computer Science & Information Technology

A catch block specifies the type of exception it can catch and immediately terminates the program.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology