Hour 15. Responding to User Input

The 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, 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, ...

Get SAMS Teach Yourself Programming with Java™ in 24 Hours, FOURTH EDITION now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.