The fact that panels can contain other panels means that you can have many levels of components containing other components, as shown in the illustration on the right. The sizes and positions of the components in a container are usually controlled by a layout manager . Different layout managers implement different ways of arranging components. FlowLayout , GridLayout , BorderLayout , CardLayout and GridBagLayout . It is also possible to define new layout managers, if none of these suit your purpose.
Every container is assigned a default layout manager when it is first created.
For Panels , including Applets , the default layout manager belongs to the class FlowLayout . For Windows , the default layout manager is a BorderLayout . It is possible to set the LayoutManager of a container to be null . This allows you to take complete charge of laying out the components in the container. I will discuss this option further in Section 4 .