Panel
is a fairly generic Container
whose primary purpose is to subdivide the drawing area into separate rectangular pieces. Since each Panel
can have its own LayoutManager
, you can do many things with panels that you can't do with a single LayoutManager
.
For example, suppose you want a TextArea
in the center of an applet with a Button
below, like this:
There's no single LayoutManager
that will produce this. A BorderLayout
will expand the Button
to fill the entire width of the applet.
A FlowLayout
won't make the TextArea
big enough.