Table of Contents
Objects At their Best
The Abstract Window Toolkit (AWT)
GUI In Action
What GUI Support Entails
GUI Tasks and Issues
Applets
Life Cycle of An Applet
Applet Class (Default) Behavior
A Sample Applet: BasicElements
Extending The Applet Class (1)
Overriding init:Control Creation and Placement
Event Handling
Is Anyone Listening?
Overriding init:Listener Registration
Extending The Applet Class (2)
Maintaining the Display
Components vs “Doodles”
Graphic Behavior:The Graphics Class
Overriding paint:Drawing the doodles
Back to events:actionPerformed method
Needed: Instance Variables
Overriding init:Initializing currentColor
The BasicElements Applet
Running an Applet
Using BasicElements Applet:What's The Problem?
Wanted: Component for Drawing
Improving BasicElements: Canvas
General Strategy For Using Canvas
MyCanvas: Overview
MyCanvas: paint
MyCanvas: actionPerformed
MyCanvas: Instance Variables
MyCanvas: Constructor
Improved Applet: BetterBasicElements
Placing Controls
Components and Containers
The add Method
LayoutManager Objects
Two Layout Managers:
Using Layout Managers: setLayout method
add method
Panel Class
Using Panels
Using Panels: BestBasicElements
Using Panels: BestBasicElements
Using Panels: BestBasicElements
Using Panels: BestBasicElements
Calculator Layout: Same Strategy
GUI Ain’t Just Buttons
Event Summary
Event Classes
Java Event Naming Conventions
Listener Interfaces
BestBasicElements With TextEvents
BestBasicElements With TextEvents
MyCanvas With TextEvents
Listener Interfaces WithMultiple Methods
Pain Reliever: Adapter Classes
Using the Adapter Class
PPT Slide
A Counter Applet
The CounterApplet Class
The init Method
The actionPerformed Method
An Unexpected Benefit (Bug?)
Concern I
Concern II
Concern III
Good Interface Design
Revising the Counter Applet
The Counter Class
The CounterApplet Class
The init Method
The actionPerformed Method
Better Applet, but...
One Possible Approach
Model-View-Controller (MVC)
Model
View
Controller
Document-View
Model as Observed
Symmetric with Event Handling
View as Observer
The Symmetry Continues
The Counter Applet Using MVC
CounterObserver Interface
Counter Class Overview
Counter Class
Counter’s Manipulator Methods
Counter’s Observer-Related Methods
CounterApplet Class Overview
CounterApplet Class
The init Method
The Event-Handling Methods
The counterHasChanged Method
Now Let’s Have Some Fun!
Counters...
… Logs, ...
… and Alarms
Class Overview
Class Overview (II)
Class Overview (III)
Counter Class
The registerAsObserver Method
The notifyObservers Method
CounterLogger Class
CounterPanel Class
CounterPanel Constructor
The Event-Handler Method
The counterHasChanged Method
CounterAlarmPanel Class
The add Method
The paint Method
The counterHasChanged Method
CounterApplet Class
CounterAlarm Class
Where Do You Go From Here?Net Resources
Where Do You Go From Here?Books
Where Do You Go From Here?Development Tools
|