The CardLayout is unusual. It breaks the applet into a deck of cards, each of which will normally have a panel with its own LayoutManager. Only one card appears on the screen at a time. You then flip between cards, each of which shows a different set of components. The common analogy is with an installer wizard. This might be used for a series of data input screens, where more input is needed than can comfortably be fit on one screen. Conversely, you can use a CardLayout for a slide show, where there's more data to be presented than will fit on one screen.

For example, this CardTest applet, one of Sun's standard demo applets, uses a CardLayout to flip between different layouts for the same five buttons:

Applet using a card layout

Previous | Next | Top | Cafe au Lait

Copyright 1997, 2002, 2006 Elliotte Rusty Harold
Last Modified Augsut 16, 2006