This example shows the CardLayout manager. Pressing any one of three button available will show a different "card". Ex.If red Button is clicked,the panel with re background is Shown. Panels in card layout are switched using show() method.
import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; public class CardLayoutDemo extends Frame implements ActionListener { Panel cardPanel; Panel p1,p2,p3; Panel buttonP; Button b1,b2,b3; CardLayout cLAyout; |