answersLogoWhite

0


Best Answer

Listeners are java classes which extend EventListener. Event handling is a process of notifying listeners of an event. For example if you click a button, the AWT thread will process the click and the button will notify any of it's relevant listeners of the event that just occurred, calling all the added ActionListeners actionPerformed functions.

When events happen the system doesn't know who to tell about the actions. Telling everybody would be a waste. So listeners are required to be registered to the various Swing and AWT classes, as well as any custom listeners you may want to write, so as to know who should be told when something happens. Which is how the listener paradigm works thus implementing event handling (at least in Java).

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What are listeners and how it is used in event handling?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Definition of event handling in java?

When an application or a program keeps on monitoring and quickly responds to any action that occurs at the GUI interface ,like mouse movement, selecting an item in a list or entering a keyboard input and so on then such a scenario is termed as event handling. In java the events from the event sources are captured and they are sent to event listeners for respective actions to be taken.


What part of the Alice system is used to link an event to an event handling method?

Nothing


What is a delegation event model in java?

Event model is based on the concept of an 'Event Source' and 'Event Listeners'. Any object that is interested in receiving messages (or events ) is called an Event Listener. Any object that generates these messages ( or events ) is called an Event Source Event Delegation Model is based on four concepts: The Event Classes The Event Listeners Explicit Event Enabling Adapters The modern approach to handling events is based on the delegation event model, which defines standard and consistent mechanisms to generate and process events. Its concept is quite simple: a source generates an event and sends it to one or more listeners. In this scheme, the listener simply waits until it receives an event. Once received, the listener processes the event and then returns. The advantage of this design is that the application logic that processes events is cleanly separated from the user interface logic that generates those events. A user interface element is able to "delegate" the processing of an event to a separate piece of code.


What interface is extended by AWT event listeners?

The AWTEventListener interface implements the EventListener interface.


What are two basic steps for event handling in java?

1.Implement the Listener interface and overrides its methods 2.Register the component with the Listener

Related questions

Definition of event handling in java?

When an application or a program keeps on monitoring and quickly responds to any action that occurs at the GUI interface ,like mouse movement, selecting an item in a list or entering a keyboard input and so on then such a scenario is termed as event handling. In java the events from the event sources are captured and they are sent to event listeners for respective actions to be taken.


What part of the Alice system is used to link an event to an event handling method?

Nothing


What is the difference between an event and an event listener?

Events are things that happen. Event listeners listen to these events and then do something in response.


What is a delegation event model in java?

Event model is based on the concept of an 'Event Source' and 'Event Listeners'. Any object that is interested in receiving messages (or events ) is called an Event Listener. Any object that generates these messages ( or events ) is called an Event Source Event Delegation Model is based on four concepts: The Event Classes The Event Listeners Explicit Event Enabling Adapters The modern approach to handling events is based on the delegation event model, which defines standard and consistent mechanisms to generate and process events. Its concept is quite simple: a source generates an event and sends it to one or more listeners. In this scheme, the listener simply waits until it receives an event. Once received, the listener processes the event and then returns. The advantage of this design is that the application logic that processes events is cleanly separated from the user interface logic that generates those events. A user interface element is able to "delegate" the processing of an event to a separate piece of code.


When two or more objects are added as listeners for the same event which listener is invoked first to handle the event?

First to arrive at the event.


What interface is extended by AWT event listeners?

The AWTEventListener interface implements the EventListener interface.


What are the advantages and disadvantages event handler to event properties?

what are the advantages and dis advantages of event handling in java


What is the definition audience?

The assembled spectators or listeners at a public event, such as a play, movie, concert, or meeting.


What is the use of giving triggering as an input?

Event handling


What is the collective noun for listeners?

The collective noun for listeners is an audience of listeners.


Are referential listeners the most common listeners?

No. Casual listeners are the most common type of listeners.


Which term is used to describe the character of the writer or speaker from the viewpoint of the readers or listeners?

This is referred to as the "persona" of the writer or speaker. It encompasses the traits, perspectives, and style that are presented to the audience through their writing or speaking.