Murach's Java SE 6
How to handle events and validate data

Although chapters 15 and 16 show how to do some Swing event handling, this chapter shows you how to handle events generated by all types of Swing controls. It also teaches you techniques for validating the data entered by a user in a GUI.

Chapter 17 How to handle events and validate data
How to handle events 548
The Java event model 548
Two types of Java events 550
How to structure event handling code 552
How to implement an event listener in a panel class 554
How to implement an event listener as a separate class 556
How to implement an event listener as an inner class 558
How to implement separate event listeners for each event 560
How to implement event listeners as anonymous inner classes 562
How to code low-level events 564
A summary of low-level events 564

How to work with focus events

566
How to work with keyboard events 568
How to work with adapter classes 570
How to validate Swing input data 572
How to display error messages 572

How to validate the data entered into a text field

574
The SwingValidator class 576
How to validate multiple entries 578
The Product Maintenance application 580
The specifications 580

The code

582




Murach's Java SE 6

Learn more about this book

Add this book to your cart



Our Ironclad Guarantee

First, try our books for 90 days. Then, if you aren't completely convinced that our books are the best ones you've ever used, you can return them for a full refund...no questions asked.