Event-Driven Applications
An Introduction with Examples in Java
Prof. David Bernstein
James Madison University
Computer Science Department
bernstdh@jmu.edu
Motivation
Multi-Threaded Applications:
It can be very difficult to ensure that the right things happen at the right time
Overcoming this Difficulty:
Focuses on how classes should handle events rather than on how or when these events will occur
Designing Event-Driven Applications
Focus On:
The events that can occur (e.g., mouse clicks, timing signals, key presses);
The classes that can generate events of different kinds (often called
event producers
; and
The classes that need to respond to events of different kinds (often called
event handlers
.
Do Not Focus On:
The order in which events occur
Events
One Simple Implementation
javaexamples/events/Event.java