title: Why isn't the first panel showing in my cardlayout
body: <p>Sorry for the code dump but Im not sure where is causing the issue. When I click the Round Robin button its supposed to take me to the RoundRobin page (which it does) but then I should be able to click the start and the center panel which is blue should yellow animation panel which is yellow. When I run this, I just see the yellow animation panel and when I click start I get a &quot;Exception in thread &quot;AWT-EventQueue-0&quot; java.lang.IllegalArgumentException: wrong parent for CardLayout&quot; error.</p>
  <pre><code>/**
       * @description:scheduling algoritmn visualisation app
       * @version: 1.0
       * @date created: 22/11/2020
       */
      
      import javax.swing.*;
      import javax.swing.border.EmptyBorder;
      import java.awt.*;
      import java.awt.event.*;
      import java.awt.image.*;
      import java.io.*;
      import javax.imageio.ImageIO;
      import java.net.*; 
      
      public class SchedulingAlgorithms extends JFrame{
          CardLayout cl;
          JPanel contentPane;
          Container deckPanel;
          Image image;
      
          /**
           * Constructor for objects of class SchedulingAlgorithms
           */
          public SchedulingAlgorithms(){
              setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              setBounds(100, 100, 658, 336);
              contentPane = new JPanel();
              contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
              setContentPane(contentPane);
              contentPane.setLayout(null);
                  
              JPanel headerPanel = new JPanel();
              JLabel label = new JLabel();
              headerPanel.setBackground(Color.LIGHT_GRAY);
              headerPanel.setBounds(5, 5, 125, 106);
              contentPane.add(headerPanel);
              
              
              try{
                  URL url = new URL(&quot;file:C:///Users//alyssa//Scheduling_Animations//icon.png&quot;);        
                  image=ImageIO.read(url);
                  headerPanel.add(new JLabel(new ImageIcon(image)));
              }catch (IOException e) {
                  e.printStackTrace();
              } 
              
              
              JPanel btnPanel = new JPanel();
              btnPanel.setBackground(Color.LIGHT_GRAY);
              btnPanel.setBounds(5, 111, 125, 181);
              contentPane.add(btnPanel);
              btnPanel.setLayout(null);
              cl= new CardLayout();
          
              JPanel deckPanel = new JPanel();
              deckPanel.setBounds(140, 5, 492, 287);
              contentPane.add(deckPanel);
              deckPanel.setLayout(cl);
                  
              JPanel home = new JPanel();
              deckPanel.add(home, &quot;home&quot;);
              
              JPanel homePic = new JPanel(new GridLayout(2,1));
              home.add(homePic, &quot;homePic&quot;);
              
              JLabel instructions1 = new JLabel();
              instructions1.setText(&quot;Select a scheduling algorithm to see it's visual representation&quot;);
              homePic.add(instructions1);
              
              try{
                  URL url = new URL(&quot;file:C:///Users//alyssa//Scheduling_Animations//schedule.png&quot;);        
                  image=ImageIO.read(url);
                  homePic.add(new JLabel(new ImageIcon(image)));
              }catch (IOException e) {
                  e.printStackTrace();
              }                
              JPanel card1 = new JPanel();
              deckPanel.add(card1, &quot;rr&quot;);
              card1.setLayout(new BorderLayout());
              
              JLabel txt2= new JLabel();
              txt2.setText(&quot;Round Robin: Set the boundaries of the animation&quot;);
              card1.add(txt2);
                         
                  
              JPanel card2 = new JPanel();
              deckPanel.add(card2, &quot;fcfs&quot;);
                  
              JTextArea txt3 = new JTextArea();
              txt3.setText(&quot;First-Come-First-Served&quot;);
              card2.add(txt3);
                  
              JPanel card3 = new JPanel();
              deckPanel.add(card3, &quot;sjf&quot;);
                  
              JTextArea txt4 = new JTextArea();
              txt4.setText(&quot;Shortest Job First&quot;);
              card3.add(txt4);
                  
              JPanel card4 = new JPanel();
              deckPanel.add(card4, &quot;ps&quot;);
                  
              JTextArea txt5 = new JTextArea();
              txt5.setText(&quot;Priority Scheduling&quot;);
              card4.add(txt5);
              
              JButton btn0 = new JButton(&quot;Home&quot;);
              btn0.addActionListener(new ActionListener() {
                  public void actionPerformed(ActionEvent e) {
                      if(e.getActionCommand()==&quot;Home&quot;)
                      cl.show(deckPanel, &quot;home&quot;);
                  }
              });
              btn0.setBounds(10, 11, 89, 23);
              btnPanel.add(btn0);
                  
              JButton btn1 = new JButton(&quot;Round Robin&quot;);
              btn1.setBounds(10, 45, 89, 23);
              btnPanel.add(btn1);
              
              btn1.addActionListener(new ActionListener() {
                  public void actionPerformed(ActionEvent e) {                
                      if(e.getActionCommand()==&quot;Round Robin&quot;)
                      cl.show(deckPanel, &quot;rr&quot;);
                  }
              });
              
                  
              JButton btn2 = new JButton(&quot;First-Come-First-Served&quot;);
              btn2.setBounds(10, 79, 89, 23);
              btnPanel.add(btn2);
              
              btn2.addActionListener(new ActionListener() {
                  public void actionPerformed(ActionEvent e) {                
                      if(e.getActionCommand()==&quot;First-Come-First-Served&quot;)
                      cl.show(deckPanel, &quot;fcfs&quot;);
                  }
              });
                  
              JButton btn3 = new JButton(&quot;Shortest Job First&quot;);
              btn3.setBounds(10, 113, 89, 23);
              btnPanel.add(btn3);
          
              btn3.addActionListener(new ActionListener() {
                  public void actionPerformed(ActionEvent e) {                
                      if(e.getActionCommand()==&quot;Shortest Job First&quot;)
                      cl.show(deckPanel, &quot;sjf&quot;);
                  }
              });
                  
              JButton btn4 = new JButton(&quot;Priority Scheduling&quot;);
              btn4.setBounds(10, 147, 89, 23);
              btnPanel.add(btn4);
              
              btn4.addActionListener(new ActionListener() {
                  public void actionPerformed(ActionEvent e) {                
                      if(e.getActionCommand()==&quot;Priority Scheduling&quot;)
                      cl.show(deckPanel, &quot;ps&quot;);
                  }
              });
              
             JPanel northPanel=new JPanel();
             card1.add(northPanel,BorderLayout.NORTH);
             
             JLabel heading=new JLabel();
             heading.setText(&quot;Round Robin.&quot;);
             northPanel.add(heading);
             JLabel instructions2= new JLabel();
             instructions2.setText(&quot;Set the boundaries of the animation&quot;);          
             northPanel.add(instructions2);
             
             JPanel centerPanel=new JPanel();
             centerPanel.setBackground(Color.blue);
             card1.add(centerPanel,BorderLayout.CENTER);
             centerPanel.setLayout(new CardLayout());
             
             JPanel animPanel=new JPanel();
             animPanel.setBackground(Color.yellow);
             centerPanel.add(animPanel,&quot;anim&quot;);
             
             
             JPanel southPanel=new JPanel();
             card1.add(southPanel,BorderLayout.SOUTH);
             
             JButton start = new JButton(&quot;START&quot;);
             start.addActionListener(new ActionListener() {
                 public void actionPerformed(ActionEvent e) {
                     if(e.getActionCommand()==&quot;START&quot;)
                     cl.show(centerPanel, &quot;anim&quot;);
                 }
             });
             start.setBounds(311, 159, 65, 23);
             southPanel.add(start);           
  
          }
  
         public static void main(String[] args) {
          EventQueue.invokeLater(new Runnable() {
              public void run() {
              try {
                  SchedulingAlgorithms frame = new SchedulingAlgorithms();
                  frame.setVisible(true);
              } catch (Exception e) {
                  e.printStackTrace();
              }
              }
          });
         }
  }
  </code></pre>