Lesson 12. Responding to User Input
Designing a Java program with a graphical user interface (GUI) isn’t very useful if the user can’t do anything to it. To make the program completely functional, you must make the interface receptive to user events.
Swing handles events with a set of interfaces called event listeners. You create a listener object and associate it with the user interface component being monitored.
During this lesson, you will learn how to add listeners to your Swing WWprograms to handle action events, mouse events, and other interaction. When you’re finished, you will have created full Java applications using the Swing set of classes.
Event Listeners
If a class wants to respond to a user event in Java, it must implement the ...
Get Sams Teach Yourself Java in 21 Days (Covers Java 11/12), 8th 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.