Copyright (c) SEMM NL All rights reserved.
Author : Paul Hamaker. Part of JavaLessons.com

By clicking one of the buttons the corresponding Panel/card is laid on top ....

of the red bottom Panel pl2.

There are 2 main Panels. The first is attached to the top of the contentpane and the second one occupies all remaining space.

The three card-panels are each filled with a different set of components.

CardLayout is set for pl2 ....

and the card-panels are added to it with a name for identification .

When one of the buttons is clicked, the proper card-Panel is shown by telling pl2's CardLayout manager to do so.

============

NOTE

============

We could construct a CardLayout without parameters :
    ... new CardLayout( )

Then each card would cover pl2 completely.