For a better understanding of how CardLayout works, copy the example program from the tutorial and experiment with it.
Type: Posts; User: Norm
For a better understanding of how CardLayout works, copy the example program from the tutorial and experiment with it.
That requires that the buttons have action listeners.
See the tutorial: How to Write an Action Listener (The Java™ Tutorials > Creating a GUI With JFC/Swing > Writing Event Listeners)
and also for...