L'ajout de panneau à conteneur avec Java swing

J'en ai fait deux panneaux et ensuite ajouté dans le troisième panneau. Comment puis-je ajouter un panneau à afficher à l'écran?

Voici mon code actuel:

import javax.swing.*;
import java.awt.*;

public class LibraryFront {

public static void main(String[] args)
{

    JFrame f1 = new JFrame();
    JPanel cards;
    final String BUTTONPANEL = "Card with JButtons";
    final String TEXTPANEL = "Card with JTextField";

    JPanel card1 = new JPanel();
    JPanel card2 = new JPanel();

    //Create the panel that contains the "cards".
    cards = new JPanel(new CardLayout());
    cards.add(card1, BUTTONPANEL);
    cards.add(card2, TEXTPANEL);

    Container c = getContentPane(); //this gives error
}
InformationsquelleAutor | 2011-01-13