WDD_lec_12 - Web Design & Development Lecture 12 Event...

Info iconThis preview shows pages 1–11. Sign up to view the full content.

View Full Document Right Arrow Icon
Lecture 12
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Event Handling part 2
Background image of page 2
Important Points Revisited
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Important Points Revisited To handle a particular kind of event, we have to implement a corresponding interface For example Button generates action event, we have to implement ActionListener interface to handle action events Window generates window event, we have to implement WindowListener interface to handle window evetns
Background image of page 4
Important Points Revisited Event Handling Steps Step 1 Create components which can generate events Step 2 Build component (objects) that can handle events (Event Handlers) Step 3 Register handlers with generators
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
More Examples
Background image of page 6
Handling Mouse Events
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Handling Mouse Events Mouse events can be trapped for any GUI component that inherit from Component class. For example, JPanel, JFrame & JButton etc. To handle Mouse events, two types of listener interfaces are available MouseMotionListener MouseListener
Background image of page 8
Handling Mouse Events MouseMotionListener For processing mouse motion events Mouse motion event is generated when mouse is moved or dragged public interface MouseMotionListener { public void mouseDragged (MouseEvent me); public void mouseMoved (MouseEvent me); }
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Handling Mouse Events MouseListener For processing “interesting” mouse events Mouse event is generated when mouse is Pressed Released
Background image of page 10
Image of page 11
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 26

WDD_lec_12 - Web Design & Development Lecture 12 Event...

This preview shows document pages 1 - 11. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online