SlideShare a Scribd company logo
Core Java

Debasish Pratihari

Event Handling :


Event : An event describe in sufficient details, a
particular user action



Instead the program takes care of collecting the
event, the java run-time notifies the program
about the event.



Program that handles user action in this fashion
is called event-driven programming.

System View of Event Handling

Key Strokes, Mouse Actions

Operating System

Java Run-Time

Event
Handlers

Lecture/core/event/18

Event
Handlers

Event
Handlers

Page #1

Event
Handlers

feel the Technology…
Core Java

Debasish Pratihari

Event Types


Low-level Events
o These are events that are arises from the
keyboard or from mouse.



Semantic Events
o These are specific component-related
events

Low –level Event :
Event

Description

FocusEvent

MouseEvent

KeyEvent
WindowEvent
ComponenetEvent
ContainerEvent

Generated when a component gets or loses
input focus.
Generated when the mouse is dragged,
moved, clicked, pressed or released ; also
generated when the mouse enters or exits
a component.
Generated when input is received from the
keyboard.
Generated when a window is activated,
closed, deactivated, deiconified, iconified,
opened or quit.
Generated when a component is hidden,
moved, resized, or became visible.
Generated when a component is added to
or removed from a container.

Relationship Among classes
EventObject

java.util

AWTEvent

java.awt

ContainerEvent

ComponentEvent
WindowEvent

MouseEvent

Lecture/core/event/18

InputEvent

FocusEvent

KeyEvent

Page #2

feel the Technology…
Core Java

Debasish Pratihari

Semantic Events :

Event

ActionEvent

ItemEvent
AdjustEvent

Description

Generated when a button is pressed, a
list item is double-clicked, or a menu
item is selected.
Generated when a check box or list item
is clicked, choice selection is made or a
checkable menu item is selected or
deselected.
Generated on actions on a scrollbar.

Relationship among classes :
EventObject

AWTEvent

ActionEvent

ItemEvent

java.util

java.awt

TextEvent

AdjustmentObject

Listener Interfaces and their Methods:



ActionListener interface:
public abstract void actionPerformed(ActionEvent

e)

AdjustmentListener interface:
public abstract void adjustmentValueChanged(AdjustmentEvent e)





FocusListener interface:
public abstract void focusGained(FocusEvent e)
public abstract void focusLost(FocusEvent e)
ItemListener interface:

public abstract void itemStateChanged(ItemEvent e)

Lecture/core/event/18

Page #3

feel the Technology…
Core Java


Debasish Pratihari

KeyListener interface:

public abstract void keyPressed(KeyEvent e)
public abstract void keyReleased(KeyEvent e)
public abstract void keyTyped(KeyEvent e)


MouseListener interface:

public abstract void mouseClicked(MouseEvent e)
public abstract void mouseEntered(MouseEvent e)
public abstract void mouseExited(MouseEvent e)
public abstract void mousePressed(MouseEvent e)
public abstract void mouseReleased(MouseEvent e)


MouseMotionListener interface

public abstract void mouseDragged(MouseMotionEvent e)
public abstract void mouseMoved(MouseMotionEvent e)



WindowListener interface:

25%
public abstract void windowActivated(WindowEvent
public
public
public
public
public
public



abstract
abstract
abstract
abstract
abstract
abstract

void
void
void
void
void
void

e)
windowClosed(WindowEvent e)
windowClosing(WindowEvent e)
windowDeactivated(WindowEvent e)
windowDeiconified(WindowEvent e)
windowIconified(WindowEvent e)
windowOpened(WindowEvent e)

TextListener interface:

public abstract void textValueChanged(TextEvent


e)

ComponentListener interface:

public abstract void componentHidden(ComponentEvent e)
public abstract void componentMoved(ComponentEvent e)
public abstract void componentResizes(ComponentEvent e)
public abstract void componentShown(ComponentEvent e)


ContainerListener interface:

public abstract void componentAdded(ContainerEvent e)
public abstract void componentRemoved(ContainerEvent e)

Lecture/core/event/18

Page #4

feel the Technology…

More Related Content

PDF
Unit-3 event handling
PPT
Java gui event
PPTX
Event handling in Java(part 1)
PPT
Java eventhandling
PPT
Java Event Handling
PPTX
Event Handling in Java
PPTX
tL20 event handling
PDF
Ajp notes-chapter-03
Unit-3 event handling
Java gui event
Event handling in Java(part 1)
Java eventhandling
Java Event Handling
Event Handling in Java
tL20 event handling
Ajp notes-chapter-03

What's hot (17)

PPTX
What is Event
PPT
Event handling63
PDF
JAVA GUI PART III
PPTX
Event Handling in JAVA
PPTX
Event Handling in java
PPTX
Advance Java Programming(CM5I) Event handling
PPTX
Event handling
DOCX
Lecture8 oopj
PDF
Android UI Fundamentals part 1
PDF
Intents in Android
DOCX
Dr Jammi Ashok - Introduction to Java Material (OOPs)
PPTX
Android components
PPTX
Android activity lifecycle
PPTX
Android apps development
ODP
Ppt 2 android_basics
PPTX
04 activities - Android
What is Event
Event handling63
JAVA GUI PART III
Event Handling in JAVA
Event Handling in java
Advance Java Programming(CM5I) Event handling
Event handling
Lecture8 oopj
Android UI Fundamentals part 1
Intents in Android
Dr Jammi Ashok - Introduction to Java Material (OOPs)
Android components
Android activity lifecycle
Android apps development
Ppt 2 android_basics
04 activities - Android
Ad

Viewers also liked (20)

PPT
Learning Pool Social Care Webinar Presentation
PPT
Fip lezing Istanbul deel 3
PDF
Scenario exercise 2014 mid atlantic technical communication conference DDeBoard
DOC
Worksheet
PPTX
The Big Bang of the Internet of Things
KEY
Workshop logeion 1004 webversie
PDF
Convtracking jan05
PDF
Lecture 22
PDF
Lecture 16
PDF
PPTX
Hari
PDF
Reed business preso
PPTX
Editing
PPTX
产品思考
DOCX
Ucapan gb
PPTX
Learning pool community rewards
PDF
Codemotion 2012 : Sphinx: Open Source Search Server
PPS
Para Que Serve O Galego
PPT
纖維 Revision
PDF
Continuous Deployment at Disqus (Pylons Minicon)
Learning Pool Social Care Webinar Presentation
Fip lezing Istanbul deel 3
Scenario exercise 2014 mid atlantic technical communication conference DDeBoard
Worksheet
The Big Bang of the Internet of Things
Workshop logeion 1004 webversie
Convtracking jan05
Lecture 22
Lecture 16
Hari
Reed business preso
Editing
产品思考
Ucapan gb
Learning pool community rewards
Codemotion 2012 : Sphinx: Open Source Search Server
Para Que Serve O Galego
纖維 Revision
Continuous Deployment at Disqus (Pylons Minicon)
Ad

Similar to Lecture 18 (20)

PPTX
Module 5.pptx
PPTX
EVENT DRIVEN PROGRAMMING SWING APPLET AWT
PPTX
UNIT III Event Handling of the car j.pptx
PPT
Chapter 8 event Handling.ppt m m m m m m
PPTX
EventHandling in object oriented programming
PPT
Events1
PDF
JAVA PROGRAMMING- GUI Programming with Swing - The Swing Buttons
PPTX
Advance java programming- Event handling
PPTX
Module3.11.pptx
PPTX
event-handling.pptx
PDF
Event Handling in Java as per university
PPT
unit-6.pptbjjdjdkd ndmdkjdjdjjdkfjjfjfjfj
PPT
Unit 6 Java
PPS
Dacj 2-2 b
PPT
09events
PPT
Unit 5.133333333333333333333333333333333.ppt
PPTX
event-handling.pptx
PPTX
Java Abstract Window Toolkit (AWT) Presentation. 2024
PPTX
Java Abstract Window Toolkit (AWT) Presentation. 2024
PPT
Event handling62
Module 5.pptx
EVENT DRIVEN PROGRAMMING SWING APPLET AWT
UNIT III Event Handling of the car j.pptx
Chapter 8 event Handling.ppt m m m m m m
EventHandling in object oriented programming
Events1
JAVA PROGRAMMING- GUI Programming with Swing - The Swing Buttons
Advance java programming- Event handling
Module3.11.pptx
event-handling.pptx
Event Handling in Java as per university
unit-6.pptbjjdjdkd ndmdkjdjdjjdkfjjfjfjfj
Unit 6 Java
Dacj 2-2 b
09events
Unit 5.133333333333333333333333333333333.ppt
event-handling.pptx
Java Abstract Window Toolkit (AWT) Presentation. 2024
Java Abstract Window Toolkit (AWT) Presentation. 2024
Event handling62

More from Debasish Pratihari (17)

PDF
Lecture 24
PDF
Lecture 23
PDF
Lecture 21
PDF
Lecture 20
PDF
Lecture 19
PDF
Lecture 17
PDF
Lecture 14
PDF
Lecture 10
PDF
PDF
PDF
PDF
PDF
PDF
PDF
PDF
PDF

Recently uploaded (20)

PDF
Empathic Computing: Creating Shared Understanding
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Encapsulation theory and applications.pdf
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
Spectroscopy.pptx food analysis technology
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Electronic commerce courselecture one. Pdf
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Machine learning based COVID-19 study performance prediction
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Chapter 3 Spatial Domain Image Processing.pdf
Empathic Computing: Creating Shared Understanding
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Programs and apps: productivity, graphics, security and other tools
Dropbox Q2 2025 Financial Results & Investor Presentation
Encapsulation_ Review paper, used for researhc scholars
Encapsulation theory and applications.pdf
Mobile App Security Testing_ A Comprehensive Guide.pdf
Spectroscopy.pptx food analysis technology
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
“AI and Expert System Decision Support & Business Intelligence Systems”
Electronic commerce courselecture one. Pdf
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Diabetes mellitus diagnosis method based random forest with bat algorithm
Machine learning based COVID-19 study performance prediction
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Per capita expenditure prediction using model stacking based on satellite ima...
sap open course for s4hana steps from ECC to s4
Chapter 3 Spatial Domain Image Processing.pdf

Lecture 18

  • 1. Core Java Debasish Pratihari Event Handling :  Event : An event describe in sufficient details, a particular user action  Instead the program takes care of collecting the event, the java run-time notifies the program about the event.  Program that handles user action in this fashion is called event-driven programming. System View of Event Handling Key Strokes, Mouse Actions Operating System Java Run-Time Event Handlers Lecture/core/event/18 Event Handlers Event Handlers Page #1 Event Handlers feel the Technology…
  • 2. Core Java Debasish Pratihari Event Types  Low-level Events o These are events that are arises from the keyboard or from mouse.  Semantic Events o These are specific component-related events Low –level Event : Event Description FocusEvent MouseEvent KeyEvent WindowEvent ComponenetEvent ContainerEvent Generated when a component gets or loses input focus. Generated when the mouse is dragged, moved, clicked, pressed or released ; also generated when the mouse enters or exits a component. Generated when input is received from the keyboard. Generated when a window is activated, closed, deactivated, deiconified, iconified, opened or quit. Generated when a component is hidden, moved, resized, or became visible. Generated when a component is added to or removed from a container. Relationship Among classes EventObject java.util AWTEvent java.awt ContainerEvent ComponentEvent WindowEvent MouseEvent Lecture/core/event/18 InputEvent FocusEvent KeyEvent Page #2 feel the Technology…
  • 3. Core Java Debasish Pratihari Semantic Events : Event ActionEvent ItemEvent AdjustEvent Description Generated when a button is pressed, a list item is double-clicked, or a menu item is selected. Generated when a check box or list item is clicked, choice selection is made or a checkable menu item is selected or deselected. Generated on actions on a scrollbar. Relationship among classes : EventObject AWTEvent ActionEvent ItemEvent java.util java.awt TextEvent AdjustmentObject Listener Interfaces and their Methods:   ActionListener interface: public abstract void actionPerformed(ActionEvent e) AdjustmentListener interface: public abstract void adjustmentValueChanged(AdjustmentEvent e)   FocusListener interface: public abstract void focusGained(FocusEvent e) public abstract void focusLost(FocusEvent e) ItemListener interface: public abstract void itemStateChanged(ItemEvent e) Lecture/core/event/18 Page #3 feel the Technology…
  • 4. Core Java  Debasish Pratihari KeyListener interface: public abstract void keyPressed(KeyEvent e) public abstract void keyReleased(KeyEvent e) public abstract void keyTyped(KeyEvent e)  MouseListener interface: public abstract void mouseClicked(MouseEvent e) public abstract void mouseEntered(MouseEvent e) public abstract void mouseExited(MouseEvent e) public abstract void mousePressed(MouseEvent e) public abstract void mouseReleased(MouseEvent e)  MouseMotionListener interface public abstract void mouseDragged(MouseMotionEvent e) public abstract void mouseMoved(MouseMotionEvent e)  WindowListener interface: 25% public abstract void windowActivated(WindowEvent public public public public public public  abstract abstract abstract abstract abstract abstract void void void void void void e) windowClosed(WindowEvent e) windowClosing(WindowEvent e) windowDeactivated(WindowEvent e) windowDeiconified(WindowEvent e) windowIconified(WindowEvent e) windowOpened(WindowEvent e) TextListener interface: public abstract void textValueChanged(TextEvent  e) ComponentListener interface: public abstract void componentHidden(ComponentEvent e) public abstract void componentMoved(ComponentEvent e) public abstract void componentResizes(ComponentEvent e) public abstract void componentShown(ComponentEvent e)  ContainerListener interface: public abstract void componentAdded(ContainerEvent e) public abstract void componentRemoved(ContainerEvent e) Lecture/core/event/18 Page #4 feel the Technology…