CardLayout cardlay = new CardLayout(); JPanel middle = new JPanel(cardlay); //what if inside the cardlayout, we always call a new itemPane