Container:
The Container class is a subclass of Component. Container has further methods which permit other Component objects to be nested inside it. Additional Container objects could be stored inside of a Container (because they are themselves objects of Component).That makes for a multileveled containment system. Container is responsible for laying out some components which is contains.
The two subclasses of the Container is
The ContainerEvent Class:
A ContainerEvent is produced whenever a component is added to or removed from a container. There are two categories of container events. A ContainerEvent class declares int constants which can be used to identify them. COMPONENT_REMOVED and COMPONENT_ADDED. They denote in which a component has been added to or removed from the container.
A ContainerEvent is a subclass of ComponentEvent and has this constructor: ContainerEvent(Component src,int type,Component comp)
Above, src is a reference to the container which produced this event. A type of the event is specified through type, and the component which has been added to or removed from the container is comp. You could gain a reference to the container which produced this event through using the getContainer() function, displays here:
Container getContainer()
A getChild() Method returns a reference to the component which was added to or removed from the container. Its common form is displays here:
Component getChild()