CardLayout
This might be a sort of newbie question, but I cannot figure out the answer.
I am using a CardLayout on a class called GamePanel which extends JPanel. I set the layout of this Panel to a CardLayout object. And I added three classes that extend JPanel to GamePanel: InfoPanel, HelpPanel and OptionsPanel. How do I get my buttonListeners on InfoPanel to switch the CardLayout so that it goes to HelpPanel next?
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.util.*;
import java.io.*;
import javax.swing.JOptionPane;
// This class is what the Applet adds, it has a Card Layout, and manages the different pages,
// which will be defined as JPanels.
publicclass GameFrameextends JPanel
{
//Instantiate Layout/Panels
private CardLayout cardLayout;
private OptionsPanel optionsPanel;
private GamePanel gamePanel;
private HelpPanel helpPanel;
private IntroPanel introPanel;
public GameFrame()
{
//initialize the card layout
cardLayout =new CardLayout();
//set the layout of the Frame
setLayout(cardLayout);
//initialize all of the panels
optionsPanel =new OptionsPanel();
gamePanel =new GamePanel();
helpPanel =new HelpPanel();
introPanel =new IntroPanel(cardLayout, optionsPanel, gamePanel, helpPanel);
//add all of the panels to the cardLayout
add(introPanel,"IntroPanel");
add(optionsPanel,"OptionsPanel");
add(gamePanel,"GamePanel");
add(helpPanel,"HelpPanel");
//set Frame to show IntroPanel
}
}
any help would be appreciated, thanks.

