[Erledigt] CardLayout zeigt nichts an

Ich weiß nicht so ganz, irgendwie zweifele ich gerade an mir. Ich hab das CardLayout schon mehrfach verwendet aber irgendwie will es gerade überhaupt nicht so wie ich will.

Ich hab ein Panel (centerpanel) das liegt auf einem JFrame, auf diesem Panel ist das CardLayout und 3 Components, aber wenn ich die einzelnen Panels anzeigen will (openDialog) wird nichts angezeigt nur ein weißes Panel.
Ich seh aber den Fehler überhaupt nicht

 * Created on 30.01.2009
 * 
 * Copyright (c) 2009, Kay Czarnotta
 * 
 * All rights reserved.
 */
package de.eagleside.databasedesigner.plugins;

import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Component;
import java.awt.FlowLayout;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;

import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JTabbedPane;
import javax.swing.JTextField;

import de.eagleside.GUIUtil;
import de.eagleside.databasedesigner.data.Settings;
import de.eagleside.databasedesigner.data.TextSettings;
import de.eagleside.databasedesigner.io.UserFileFilter;

/**
 * @author Eagle Eye
 * 
 */
public class DatabaseImportDialog extends JDialog
{
  private static final String TAB = "tab";
  private static final String DATABASE_IMPORT = "dbimport";
  private static final String FILE_IMPORT = "fileimport";

  private static final TextSettings TEXTSETINGS = TextSettings.getInstance();
  private static final Settings SETTINGS = Settings.getInstance();

  private JTextField usernamefield, addressfield, portfield, databasenamefield, filefield;
  private JPasswordField passwordfield;
  private JPanel centerpanel, databaseimportpanel, fileimportpanel;
  private CardLayout cardlayout;
  private ProjectImporter importer;
  private JTabbedPane tabpane;
  private JButton nextbutton;// , prevbutton;

  public DatabaseImportDialog(JFrame parent)
  {
    super(parent, TEXTSETINGS.getText(TextSettings.DATABASE_DIALOG_IMPORT_TITLE), true);

    JButton cancelbutton;
    JPanel buttonpanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    buttonpanel.add(nextbutton = new JButton(TEXTSETINGS.getText(TextSettings.DIALOG_NEXT)));
    // buttonpanel.add(prevbutton = new JButton(TEXTSETINGS.getText(TextSettings.DIALOG_PREVOUS)));
    buttonpanel.add(cancelbutton = new JButton(TEXTSETINGS.getText(TextSettings.DIALOG_CANCEL)));

    setLayout(new BorderLayout());
    add(new JLabel(TEXTSETINGS.getText(TextSettings.DATABASE_DIALOG_IMPORT_HEADER)), BorderLayout.NORTH);
    add(centerpanel = new JPanel(cardlayout = new CardLayout()), BorderLayout.CENTER);
    add(buttonpanel, BorderLayout.SOUTH);

    databaseimportpanel = new JPanel(new GridBagLayout());
    GUIUtil.addComponent(databaseimportpanel, new JLabel(TEXTSETINGS.getText(TextSettings.DATABASE_DIALOG_IMPORT_USERNAME)), 0, 0, 1, 1, 0, 0, 5, 5,
        5, 5);
    GUIUtil.addComponent(databaseimportpanel, usernamefield = new JTextField(20), 1, 0, GridBagConstraints.REMAINDER, 1, 0, 0, 5, 5, 5, 5);
    GUIUtil.addComponent(databaseimportpanel, new JLabel(TEXTSETINGS.getText(TextSettings.DATABASE_DIALOG_IMPORT_PASSWORD)), 0, 1, 1, 1, 0, 0, 5, 5,
        5, 5);
    GUIUtil.addComponent(databaseimportpanel, passwordfield = new JPasswordField(20), 1, 1, GridBagConstraints.REMAINDER, 1, 1, 0, 5, 5, 5, 5);
    GUIUtil.addComponent(databaseimportpanel, new JLabel(TEXTSETINGS.getText(TextSettings.DATABASE_DIALOG_IMPORT_ADDRESS)), 0, 2, 1, 1, 0, 0, 5, 5,
        5, 5);
    GUIUtil.addComponent(databaseimportpanel, addressfield = new JPasswordField(30), 1, 2, 1, 1, 1, 0, 5, 5, 5, 5);
    GUIUtil
        .addComponent(databaseimportpanel, new JLabel(TEXTSETINGS.getText(TextSettings.DATABASE_DIALOG_IMPORT_PORT)), 2, 2, 1, 1, 0, 0, 5, 5, 5, 5);
    GUIUtil.addComponent(databaseimportpanel, portfield = new JTextField(5), 3, 2, 1, 1, 0, 0, 5, 5, 5, 5);
    GUIUtil.addComponent(databaseimportpanel, new JLabel(TEXTSETINGS.getText(TextSettings.DATABASE_DIALOG_IMPORT_DATABASE)), 0, 3, 1, 1, 0, 0, 5, 5,
        5, 5);
    GUIUtil.addComponent(databaseimportpanel, databasenamefield = new JTextField(30), 1, 3, GridBagConstraints.REMAINDER, 1, 1, 0, 5, 5, 5, 5);

    fileimportpanel = new JPanel(new GridBagLayout());
    JButton browsebutton;
    GUIUtil.addComponent(fileimportpanel, new JLabel(TEXTSETINGS.getText(TextSettings.DATABASE_DIALOG_IMPORT_SQLFILE)), 0, 0, 1, 1, 0, 0, 5, 5, 5, 5);
    GUIUtil.addComponent(fileimportpanel, filefield = new JTextField(30), 1, 0, 1, 1, 1, 0, 5, 5, 5, 5);
    GUIUtil.addComponent(fileimportpanel, browsebutton = new JButton(TEXTSETINGS.getText(TextSettings.DATABASE_DIALOG_IMPORT_FILE_BROWSE)), 2, 0, 1,
        1, 0, 0, 5, 5, 5, 5);

    tabpane = new JTabbedPane();
    tabpane.addTab(TEXTSETINGS.getText(TextSettings.DATABASE_DIALOG_IMPORT_TAB_DATABASEIMPORT), databaseimportpanel);
    tabpane.addTab(TEXTSETINGS.getText(TextSettings.DATABASE_DIALOG_IMPORT_TAB_FILEIMPORT), fileimportpanel);

    centerpanel.add(tabpane, TAB);
    cardlayout.addLayoutComponent(tabpane, TAB);
    centerpanel.add(databaseimportpanel, DATABASE_IMPORT);
    cardlayout.addLayoutComponent(databaseimportpanel, DATABASE_IMPORT);
    centerpanel.add(fileimportpanel, FILE_IMPORT);
    cardlayout.addLayoutComponent(fileimportpanel, FILE_IMPORT);

    browsebutton.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        browseFile();
      }
    });

    // prevbutton.addActionListener(new ActionListener()
    // {
    // public void actionPerformed(ActionEvent e)
    // {
    // back();
    // }
    // });
    nextbutton.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        next();
      }
    });
    cancelbutton.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        setVisible(false);
      }
    });

    pack();
    setLocationRelativeTo(parent);
  }

  private void next()
  {
    try
    {
      Component comp = centerpanel.getComponent(0);
      if(comp == tabpane && tabpane.getSelectedIndex() == 0 || comp == databaseimportpanel)
        importer.importProject(usernamefield.getText(), new String(passwordfield.getPassword()), addressfield.getText(), portfield.getText(),
            databasenamefield.getText());
      else
        if(comp == tabpane && tabpane.getSelectedIndex() == 1 || comp == fileimportpanel)
          importer.importProject(filefield.getText());
    }
    catch(Exception ex)
    {
      ex.printStackTrace();
      JOptionPane.showMessageDialog(this, "Fehler beim Import der Daten (" + ex + ")");
    }
  }

  private void back()
  {}

  private void browseFile()
  {
    JFileChooser fc = new JFileChooser(SETTINGS.getLastFileChooserPath());
    fc.addChoosableFileFilter(new UserFileFilter(".sql", TEXTSETINGS.getText(TextSettings.IO_SQL_FILE_DESCRIPTION)));
    fc.setMultiSelectionEnabled(false);
    if(fc.showOpenDialog(this) == JFileChooser.APPROVE_OPTION)
    {
      File file = fc.getSelectedFile();
      filefield.setText(SETTINGS.setLastFileChooserPath(file));
    }
  }

  public void openDialog(ProjectImporter importer)
  {
    this.importer = importer;
    usernamefield.setText("");
    addressfield.setText("");
    portfield.setText("");
    databasenamefield.setText("");
    filefield.setText("");
    passwordfield.setText("");

    switch(importer.getSupportedImportTypes())
    {
      case ProjectImporter.ALL:
        cardlayout.show(centerpanel, TAB);
        break;
      case ProjectImporter.DATABASE_IMPORT:
        cardlayout.show(centerpanel, DATABASE_IMPORT);
        break;
      case ProjectImporter.FILE_IMPORT:
      default:
        cardlayout.show(centerpanel, FILE_IMPORT);
        break;
    }
    setVisible(true);
  }
}

Ok hat sich geklärt, ich hab vergessen das eine Componente nur einem Parent zugeordnet werden kann und bei mir wurden die beiden Panels ja zweien zugeordnet.