swingeventhandling.pdf

(451 KB) Pobierz
623005238 UNPDF
GUI Event Handling
623005238.002.png
Topics
The Delegation Event Model
Event Classes
Event Listeners
> ActionListener Method
> MouseListener Methods
> MouseMotionListener Methods
> WindowListener Methods
Steps for Creating GUI Applications with
Event Handling
2
623005238.003.png
Delegation Event Model
623005238.004.png
What is Delegation Event Model?
The Delegation Event Model
> Model used by Java to handle user interaction
with GUI components
> Describes how your program can respond to user
interaction
Three important players
> Event Source
> Event Listener/Handler
> Event Object
4
623005238.005.png
Event Source, Event Listener/Handler
Event Source
> GUI component that generates the event
> Example: button
Event Listener/Handler
> Receives and handles events
> Contains business logic
> Example: displaying information useful to the
5
user, computing a value
623005238.001.png
Zgłoś jeśli naruszono regulamin