# Java Notes

# CardLayout

`java.awt.CardLayout` displays one of a number of components, typically JPanels, in a way that's similar to `JTabbedPane`. The `CardLayout` name comes from thinking of the individual panels as cards that are in a pile, where only one of them is visible on top at one time.

Program, not user, control. The selection of which panel to display is completely under program, not user, control. A `JTabbedPane` is often a better choice because it is better to give the user control. However, there are places where `CardLayout` is typically used where the user control is achieved by other means.

"Wizard" interfaces are often implemented using a `CardLayout` which is controlled by Next and Previous buttons.