A Quick and Dirty Guide to Events - PowerPoint PPT Presentation

About This Presentation
Title:

A Quick and Dirty Guide to Events

Description:

... 02 Lecture 4-2. A Quick and Dirty Guide to Events. CS 102-02. Lecture 4 ... Bill Gates dancing across the Quad in a hot pink tutu might be an event to some ... – PowerPoint PPT presentation

Number of Views:29
Avg rating:3.0/5.0
Slides: 11
Provided by: kurtdfenst
Category:
Tags: dancing | dirty | events | guide | quick

less

Transcript and Presenter's Notes

Title: A Quick and Dirty Guide to Events


1
A Quick and Dirty Guide to Events
What's happenin'?
  • CS 102-02
  • Lecture 4-3

2
That Which Must Be Done
  • What's an event?
  • Why are events important?
  • How do we deal with events in Java?

3
Events According to Webster's
4
The Computer Definition of Events
  • Events are things that happen in the world that
    objects notice
  • Bill Gates dancing across the Quad in a hot pink
    tutu might be an event to some people, but not to
    most Java objects
  • Mouse clicks, double clicks, mouse movements

5
User-Centric Programs
  • Ancient history
  • Programs led users by the nose
  • Type in this number
  • Type in that number
  • Get the printout
  • Today's enlightened programs
  • Users are in control
  • Need to track what a user is doing...

6
What to Track?
  • Need to know
  • Where's the mouse pointer which component and
    where is it within the component?
  • Who's got the focus?
  • Focus is the program's center of attention
  • If the cursor is blinking in a TextField, that's
    because the TextField has focus

7
More to Know
  • Mouse clicks
  • Single, double, triple (Or maybe how far apart
    and how long are successive clicks)
  • Which mouse button (1 for Mac, 2 for Windows, 3
    for X Windows)?
  • Keyboard
  • Which key?
  • Was it modified (Ctrl, Shift, Alt)?
  • What about function keys?

8
Some Java Events
  • ActionEvent
  • AdjustmentEvent
  • ComponentAdapter
  • ComponentEvent
  • ContainerAdapter
  • ContainerEvent
  • FocusAdapter
  • FocusEvent
  • InputEvent
  • ItemEvent
  • KeyAdapter
  • KeyEvent
  • MouseAdapter
  • MouseEvent
  • MouseMotionAdapter
  • PaintEvent
  • TextEvent
  • WindowAdapter
  • WindowEvent

9
Mouse Events
  • MOUSE_CLICKED
  • The mouse clicked event type.
  • MOUSE_DRAGGED
  • The mouse dragged event type.
  • MOUSE_ENTERED
  • The mouse entered event type.

MOUSE_EXITED The mouse exited event type.
MOUSE_MOVED The mouse moved event type.
MOUSE_PRESSED The mouse pressed event type.
MOUSE_RELEASED The mouse released event type.
10
(No Transcript)
Write a Comment
User Comments (0)
About PowerShow.com