A 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:

Applet with a text area and a button

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.

Previous | Next | Top | Cafe au Lait

Copyright 1997 Elliotte Rusty Harold
Last Modified November 11, 1997