answersLogoWhite

0

1.Implement the Listener interface and overrides its methods

2.Register the component with the Listener

User Avatar

Wiki User

12y ago

Still curious? Ask our experts.

Chat with our AI personalities

CoachCoach
Success isn't just about winning—it's about vision, patience, and playing the long game.
Chat with Coach
FranFran
I've made my fair share of mistakes, and if I can help you avoid a few, I'd sure like to try.
Chat with Fran
DevinDevin
I've poured enough drinks to know that people don't always want advice—they just want to talk.
Chat with Devin

Add your answer:

Earn +20 pts
Q: What are two basic steps for event handling in java?
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 is the purpose of NoMatchException handling method in java?

java exception


Why is event handling in java not working in Linux?

It is working, so you may have made an error, or your JRE/JDK version is too old, or whatever else.


What is difference between exception handling in C and Java?

Easy: there is no exception-handling in C.


What are listeners and how it is used in event handling?

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).