The JavaTM Tutorial

| Start of Tutorial > Start of Trail > Start of Lesson | Search

Trail: Creating a GUI with JFC/Swing
Lesson: Using Swing Components

## Using Atomic Components

> The rest of this lesson discusses the atomic components -- components that exist solely to present and perhaps accept information, rather than to contain other components. Although atomic components sometimes are implemented by combining components -- for example, an editable combo box consists of components such as a text field, button, and menu -- these combinations are look-and-feel-specific and thus not to be relied on or tampered with. An atomic component is a single entity, both to the user and to the programmer who uses its API. To see pictures of all the atomic components, go to A Visual Index to the Swing Components.

> All the atomic components descend from the `JComponent` class. Thus, they all support standard features such as tool tips and borders. For more information about the API and features all atomic components support, see The JComponent Class.

> The following atomic components exist primarily to get input from the user:

> Button, Check Box, Radio Button | Provides easy-to-use, easy-to-customize button implementations.
> Combo Box | Provides both uneditable and editable combo boxes -- buttons that bring up menus of choices.
> List | Displays a group of items that the user can choose.
> Menu | Includes menu bar, menu, and menu item implementations, including specialized menu items such as check box menu items.
> Slider | Lets the user choose one of a continuous range of values.
> Text Field | Lets the user enter a single line of text data.

> Some atomic components exist only to give information:

> Label | Presents some text, an icon, or both.
> Progress Bar | Displays progress toward a goal.
> Tool Tip | Brings up a small window that describes another component.

> The rest of the atomic components provide formatted information and a way of editing it:

> Color Chooser | A UI for choosing colors; can be used inside or outside a dialog.
> File Chooser | A UI for choosing files and directories.
> Table | An extremely flexible component that displays data in a grid format.
> Text Support | A framework including everything from simple text components, such as text fields, to a full-featured, extensible kit for building text editors.
> Tree | A component that displays hierarchical data.

| Start of Tutorial > Start of Trail > Start of Lesson | Search