Java Reference
In-Depth Information
Figure 6.1
The primary classes in the AWT hierarchy.
6.2 AWT
The AWT (Abstract Windowing Toolkit) package ( java.awt ) and sub-packages
came with Java 1.0 and still provide the essential set of classes for all Java graphics.
Even Swing builds on the graphics base in AWT. The diagram in Figure 6.1 shows
the primary members of the AWT class hierarchy.
The key Component class provides the base class for all the AWT visual
components and also for the Swing components. This class contains a very large
number of public methods (see the Java API description for Component ) that
provide access to and control of attributes of a visual component such as its
position, size, colors, and so forth. Subclasses of Component can override some
of these methods and also include new methods to deal with the specific features
of the new type of component.
Another very important class, Container ,which is itself a subclass of
Component , provides for holding instances of other components. The Window
subclass of Container , for example, provides for the top-level visible containers
Frame and Dialog that usually hold multiple visible components.
Containers can also hold other containers. The Panel class, in particular, is
used within a top-level container to hold and arrange its sub-components, which
often are also panels. An elaborate GUI display typically employs several panels
to arrange the visible atomic (non-container) components such as labels, buttons,
Search WWH ::




Custom Search