Java Reference
In-Depth Information
Swing I
17
17.1 EVENT-DRIVEN PROGRAMMING
943
Events and Listeners
Example: A Tricolor Built with Panels
972
943
The
Container
Class 976
The Model-View-Controller Pattern
★
980
17.2 BUTTONS, EVENTS, AND OTHER SWING
BASICS
944
Example: A Simple Window 945
Buttons 951
Action Listeners and Action Events 952
Example: A Better Version of Our First
Swing GUI 955
Labels 958
Color 959
Example: A GUI with a Label and Color 960
17.4 MENUS AND BUTTONS
981
Example: A GUI with a Menu 981
Menu Bars, Menus, and Menu Items
981
Nested Menus
986
The
AbstractButton
Class 986
The
setActionCommand
Method
★
989
Listeners as Inner Classes
★
990
17.5 TEXT FIELDS AND TEXT AREAS
993
Text Areas and Text Fields 994
A Swing Calculator 1001
17.3 CONTAINERS AND LAYOUT
MANAGERS
962
Border Layout Managers 963
Flow Layout Managers 966
Grid Layout Managers 967
Panels 971
Chapter Summary 1006
Answers to Self-Test Exercises 1007
Programming Projects 1013