Java Reference
In-Depth Information
17.1 Event-Driven Programming
925
Events and Listeners
925
17
17.2 Buttons, Events, and Other
Swing Basics
926
Example: A Simple Window
927
Buttons
933
Action Listeners and Action Events
934
Example: A Better Version of Our First Swing GUI
937
Labels
941
Color
942
Swing I
Example: A GUI with a Label and Color
943
17.3 Containers and Layout Managers
946
Border Layout Managers
946
Flow Layout Managers
949
Grid Layout Managers
951
Panels
955
Example: A Tricolor Built with Panels
956
The
Class
960
Container
★
The Model-View-Controller Pattern
964
17.4 Menus and Buttons
965
Example: A GUI with a Menu
965
Menu Bars, Menus, and Menu Items
965
★
Nested Menus
970
The
Class
970
AbstractButton
The
Method
973
setActionCommand
★
Listeners as Inner Classes
975
17.5 Text Fields and Text Areas
978
Text Areas and Text Fields
978
A Swing Calculator
985
Chapter Summary
991
Answers to Self-Test Exercises
992
Programming Projects
999