AWT Containers

Although Component contains many GUI-related subclasses, its Container subclass is used to define components that can contain other components, including another container. The Container class provides methods for adding, retrieving, displaying, counting, and removing the components that it contains.

The Container class also provides methods for working with layouts, which are used to control the layout of components within a container. Layouts and layout managers are discussed in Chapter 12. You should become familiar with the following methods:

  • add()— Used to add a component to the container (usually under the control of a layout class).

  • getComponent() and getComponentAt()— Obtain a reference to a component in the container. ...

Get Sun Certification Training Guide (310-025, 310-027): Java™ 2 Programmer and Developer Exams now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.