Table of Contents |
This lesson gives an overview of what the Java environment provides to help you create a user interface (UI). UI is a broad term that refers to all sorts of communication between a program and its users. UI is not only what the user sees, but what the user hears and feels. Even the speed with which a program interacts with the user is an important part of the program's UI. This lesson covers some Java classes that provide UI-related functionality. Eventually, we hope to provide a UI style guide, to give you more help with the art of designing a UI.The Java environment provides classes for the following functionality:
Applets and applications commonly present information to the user (and invite the user's interaction) using a GUI. The Abstract Window Toolkit (AWT) contains a complete set of classes for writing GUI programs.
- Displaying text using standard input and output -- Standard input and output are the old-fashioned way of presenting a user interface. They're still useful for testing and debugging programs, as well as for functionality that's not aimed at the typical end-user. See Input and Output Streams for information on using standard input and output.
- Playing sounds -- All our sound-playing capabilities are either platform-dependent or applet-specific. [point to further info]
- Saving user preferences using properties -- For information that applets and applications need to save even when they're not running, you can use properties. Applets may have problems using properties, due to security restrictions [check]. [point to further info]
- Getting applet attributes -- Attributes are an applet-only mechanism for getting user preferences.
- Presenting a graphical UI (GUI) -- The rest of this lesson gives an overview of the Java GUI support.
AWT Components
The AWT provides many standard GUI components such as buttons, lists, menus, and text areas. It also includes containers (such as windows and menu bars) and higher-level components (such as a dialog for opening or saving files).Other AWT Classes
Other classes in the AWT include those for working with graphics contexts (including basic drawing operations), images, events, fonts, and colors.The Anatomy of a GUI-Based Program
The AWT provides a framework for drawing and event handling. Using a program-specific hierarchy of containers and components, the AWT forwards events (such as mouse clicks) to the appropriate object. The same hierarchy determines the order in which containers and components draw themselves.
Table of Contents |