Java Reference
In-Depth Information
C H A P T E R 7
Creating and Enriching Graphical User
Interfaces
The applications presented in previous chapters featured Standard I/O-based user inter-
faces.Althoughthesesimplecharacter-orienteduserinterfacesareconvenientfordemon-
StubFinder
application), they are inadequate for more sophisticated needs, such as
fillingoutformsorviewingHTMLpages.However,JavaalsoprovidesAPIsthatletyou
create and enrich more sophisticated graphical user interfaces (GUIs).
Abstract Window Toolkit (AWT) is Java's original GUI-oriented API. After introdu-
cing AWT to Java, Sun Microsystems introduced Java Foundation Classes (JFC) as an
AWTsupersetwithmanynewcapabilities.JFC'smainAPIsareSwing(forcreatingmore
sophisticated GUIs), Accessibility (for supporting assistive technologies), Java 2D (for
creating high-quality graphics), and Drag and Drop (for dragging and dropping AWT/
Swing GUI components, such as buttons or textfields).
Chapter7
continuestoexplorethestandardclasslibrarybyintroducingyoutoAWT,
Swing, and Java 2D. Appendix C introduces you to Accessibility and Drag and Drop.
Abstract Window Toolkit
Abstract Window Toolkit (AWT)
is Java's original windowing system-independent API
forcreatingGUIsthatarebasedoncomponents,containers,layoutmanagers,andevents.
AWT also supports graphics, colors, fonts, images, data transfer, and more.
ThestandardclasslibraryorganizesAWT'smanytypesintothe
java.awt
package
and subpackages. However, not all
java.awt
types and subpackages belong to AWT.
For example,
java.awt.Graphics2D
and
java.awt.geom
belong to Java 2D.
Thisarrangementexistsbecausethe
java.awt
-basedpackagestructureprovidesanat-
ural fit for various non-AWT types. (AWT is often viewed as part of JFC nowadays.)