Day
13
The Java Abstract Windowing Toolkit
237
An AWT Overview................................................................................. 238
The Basic User Interface Components .................................................... 240
Labels ................................................................................................ 241
Buttons .............................................................................................. 242
Checkboxes ........................................................................................ 243
Radio Buttons .................................................................................... 244
Choice Menus ................................................................................... 245
Text Fields ......................................................................................... 247
Panels and Layout ................................................................................... 249
Layout Managers ............................................................................... 249
Insets ................................................................................................. 254
Handling UI Actions and Events ............................................................ 255
Nesting Panels and Components ............................................................ 258
Nested Panels .................................................................................... 258
Events and Nested Panels .................................................................. 258
More UI Components ............................................................................ 259
Text Areas .......................................................................................... 259
Scrolling Lists .................................................................................... 261
Scrollbars and Sliders ......................................................................... 262
Canvases ............................................................................................ 265
More UI Events ...................................................................................... 265
A Complete Example:
RGB to HSB Converter ....................................................................... 266
Create the Applet Layout ................................................................... 267
Create the Panel Layout ..................................................................... 267
Define the Subpanels ......................................................................... 269
Handle the Actions ............................................................................ 272
Update the Result .............................................................................. 272
The Complete Source Code ............................................................... 274
Summary ................................................................................................ 277
Q&A ...................................................................................................... 277
Do'stlaringiz bilan baham: |