Layout of Components in a Panel
If a container contains nested panels, the subcomponents in each panel are laid out independently.
One can lay components out “by hand”, with positioning in pixel space.
However it is very difficult to make this machine independent. Instead one tends to use general strategies embodied in several layout managers. These all implement the LayoutManager interface.
To specify a layout, such as flow layout, in your panel use the setLayout() method:
setLayout(new FlowLayout()) ;
This particular layout is the default.