Sams Teach Yourself Java 2 in 24 Hours

Sams Teach Yourself Java 2 in 24 Hours

By Rogers Cadenhead

Hour 15. Responding to User Input

A graphical user interface you developed during the past two hours can run on its own without any changes. Buttons can be clicked, text fields filled with text, and the window can be resized with wild abandon.

Sooner or later, however, even the least discriminating user is going to be left wanting more. The graphical user interface that a program offers has to cause things to happen when a mouse-click or keyboard entry occurs. Text areas and other components must be updated to show what's happening as the program runs.

These things are possible when your Java program can respond to user events. An event is something that happens when a program runs, and user events are things a user causes to happen by using the mouse, keyboard, or another input device. Responding to user events is often called event handling, and it's the activity you'll be learning about during this hour.

The following topics will be covered:

Share ThisShare This

Informit Network