1 / 8

Advanced OOP MCS-3 OOP BSCS-3 Lecture # 10

Advanced OOP MCS-3 OOP BSCS-3 Lecture # 10. TOPICS TO COVER. Handling Events Interaction of user with GUI components is called event . Java events are part of the Java AWT package . The code that performs a task in response to an event is called an event handler.

ince
Download Presentation

Advanced OOP MCS-3 OOP BSCS-3 Lecture # 10

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Advanced OOP MCS-3 OOP BSCS-3Lecture # 10

  2. TOPICS TO COVER Handling Events • Interaction of user with GUI components is called event. • Java events are part of the Java AWT package. • The code that performs a task in response to an event is called an event handler. • Overall process of responding to events is known as event handling. • GUIs are event driven. • The sourceof an event is the component that causes that event to occur. • The listenerof an event is an object that receives the event and processes it appropriately. Event Handling Process • When an event is triggered, the JAVA runtime first determines its source and type. • If a listener for this type of event is registered with the source, an event object is created. • For each listener to this type of an event, the JAVA runtime invokes the appropriate event handling method to the listener and passes the event object as the parameter.

  3. Topics To Cover Sources of Events • Button • Checkbox • Choice • List • Menu Item • Scrollbar • Text Components • Window

  4. An interface is a group of related methods with empty bodies. • Event classes and their listener interfaces are available in java.awt.event Event Handling

  5. Event Handling

  6. Event Handling • Event classes and their listener interfaces are available in java.awt.event

  7. Assignment • Q#1: Display counting of mouse clicks on title bar of frame. • Q#2: Show a label of your name, move one step down as you click on frame.

  8. Good Luck ! ☻. . .

More Related