Topic –Components
and Containers
By –Snehal Bandal
• Hierarchical
Structure of
Components
• Components
The Component class is the superclass of all components.
Component is an abstract class that encapsulates all of the
attributes of visual component
Types of components in Components class
Container
Button
Label
Checkbox
Choice
• Container
The container class is a subclass of component.
It has additional methods that allows other component objects to be nested
within it.
A container is responsible for laying out (that is positioning) any component that
it [Link] does this through the use of various layout managers.
There are two types of Swing Containers, they are top-level containers and low-
level containers.
Top-Level containers are heavyweight containers such as Jframe, Japplet,
Jwindow, and Jdialog.
Low-Level containers are lightweight containers such as Jpanel.
The most commonly used containers are Jframe, Jpanel and Jwindow.
The important methods of the Container class are add(), invalidate() and
validate().
Window
The window is a container with no borders or menu bars. To create a window, you
must use a frame, dialog, or another window.
Frame
The Frame is the container for the title bar, border, and menu bars. Other
components such as a button, text field, scrollbar, and so on can be added. When
developing an AWT application, the most commonly used container is the frame.
Panel
The Panel is the container that lacks a title bar, border, and menu bar. It is a
generic container used to hold the components. It can have other
components like buttons, text fields, etc.
GUI Diagram
Thank you