Event-Driven Programs
An Introduction with Examples in Java |
Prof. David Bernstein
|
Computer Science Department |
bernstdh@jmu.edu |
Using an Event Queue
Event Listening
Event Bubbling
JLabel
JButton
JFrame
JFrame
main()
JApplication
class that mimics the programming interface and
life-cycle of the JApplet
class
JApplication
Class
JApplication
JApplet
and JApplication
with the same functionality they will have an enormous
amount of duplicate codeRootPaneContainer
for a JApplet
has access to the start-up parameters whereas the
RootPaneContainer
for a JApplication
(which is a JFrame
) does not.
Correcting the Remaining Problems with the Decorator Pattern
MultimediaApplet
Class
The Final Design
Design of a Simple Metronome