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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.