Java User Interface Components II

In this lesson, we continue the discussion of user interface components. Earlier, we looked at the components needed to build a basic user interface. They included:

Here, we will look at some of the other components that are available. These include:

We will not look at Button since it was discussed in detail with respect to LayoutManager.

User interface components are provided through the AWT package. Most are subclasses of the Component class. The discussion here concerns the 1.1 event model. A similar discussion is available for the version 1.0 event model.

Because these components are relatively straight-forward, we will not provide a complete running applet until all have been discussed.


Labels

Labels provide a means to attach a heading to an interface component.

Checkboxes

Checkboxes are two-state components that are either "on" or "off."

Choices

The Choice class provides a pop-up menu, from which only a single item may be selected at any one time.

List

A List is a scrollable array of text items. The list may be setup in the constructor to allow either a single item to be selected at any one time or to allow multiple items to be selected.

TextArea

A TextArea is a scrollable multiline area for displaying text that may be either editable or not editable.

Popup Menus

Popup menus are displayed when the user performs the platform-dependent triggering action.

Complete Applet

The example program combines these components:


References

References useful for this discussion include the following: