Frequently Asked Questions Subject Name: OOPS with Java Unit 9: Event Handling
Balasubramani R Assistant Professor Dept. of IT
Subject Code: BT0074
Q1: What is event-handling? A1: In event handling, the program waits for the user to perform some action. The user controls the sequence of operations that the application executes through a GUI. This approach is also called event-driven programming. Q2: What is an Event Object? A2: When the user interacts with the application by pressing a key or clicking a mouse button, an event is generated. The operating system traps this event and the data associated with it, for example, the time at which the event occurred, the event type (like a keypress or a mouseclick). This data is then passed on to the application to which the event belongs. Q3: What is an Event Source? A3: An Event Source is an object that generates an event. For example, if you click on a button, an ActionEvent object is generated. The object of the ActionEvent class contains information about the event. Q4: What is is an Event Handler? A4: An Event Handler is a method that understands the event and processes it. The Event Handler method takes an event object as a parameter. Q5: What is an Event Listener? A5: An object delegates the task of handling an event to the event listener. When an event occurs, an event object of the appropriate type is created. This object is passed to the listener. A listener must implement the interface that has the method for event-handling.