GUI Programming with AWT


Below is a UML class diagram describing a small subset of the AWT which is being used in the FunFWGUI program.

awt.png (17100 bytes)

Class Component and its subclasses form  the composite pattern: look at Container.

Container uses LayoutManager as the strategy to lay out its Component objects.

Button and TextField use ActionListener as a strategy to handle event.  Window uses WindowListener instead.  In general each Component object has one or more "listeners" to AWTEvent objects.   When AWT detects a particular AWT event (e.g. a mouse click) on a Component object, it generates an appropriate AWTEvent object and hand it to the Component object in question. The Component object then calls the listeners that register for this event to respond.  For a more detailed desciption of event handling, see for example the JDK documentation for class Button.


dxnguyen@cs.rice.edu
Copyright 1999, Dung X. Nguyen - All rights reserved.