• Like
Chapter 06
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

Chapter 06

  • 37 views
Published

 

Published in Technology , Education
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
37
On SlideShare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
1
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Event-Driven Programming Chapter 6
  • 2. 6 Event Sources and Listeners An event is an object that signals something has happened. An event source is the object that raises an event. An event listener is an object responding to an event raised by an event source.
  • 3. 6 Mouse Events Import the java.awt.event.* library Implement the interface of the MouseListener class For MouseListener the programmer must implement the methods: mouseEntered() mouseExited() mousePressed() mouseReleased() mouseClicked()
  • 4. 6 MouseClick.java Applet responds to mouseClicked events by drawing ovals in the applet window
  • 5. 6 Creating a Timer Timer class raises Timer events at specific intervals. To “hear” Timer events, a class must implement the ActionListener interface. ActionListener can be defined as a standard Java-named class or as an anonymous inner class.
  • 6. 6 Anonymous Classes Defined within another class, and not given a specific name. Anonymous inner classes can be hidden from other classes in the package. These classes have access to all members of the outer class.
  • 7. 6 Anonymous Classes Defined within another class, and not given a specific name. Anonymous inner classes can be hidden from other classes in the package. These classes have access to all members of the outer class.