Import [Link].
*;
Import [Link].*;
Import [Link];
Import [Link].*;
Public class CardLayoutDemo extends JFrame implements ActionListener {
CardLayout card;
JButton b1, b2, b3;
Container c;
CardLayoutDemo()
C = getContentPane();
Card = new CardLayout(40, 30);
[Link](card);
b1 = new JButton(“First Level”);
b2 = new JButton(“Second Level”);
[Link](this);
[Link](this);
[Link](“a”, b1);
[Link](“b”, b2);
}
Public void actionPerformed(ActionEvent e)
[Link](c);
Public static void main(String[] args)
CardLayoutDemo cl = new CardLayoutDemo();
[Link](400, 400);
[Link](true);
[Link](EXIT_ON_CLOSE);
********************************OUTPUT **********************************
****************************OUTPUT**************************