title: JPanels not added to JTabbedPane
body: <p>
  For my homework extra credit I am creating a JTabbedPane and adding two Jpanels. I feel like I am very close, but it still does not compile. When I run it, both JPanels open, but the JTabbedPane does not. I get a lot of Unknown Source errors. I suspect that at this point my issue in in the JPanels themselves because they started out being JFrames and I have tried (unsuccessfully I think) to convert the JFrames to JPanels.</p>
  
  <p>JTabbedPaneAssignment is supposed to create the JTabbedPane and populate the two panes with the apps DayGui on one tab and OfficeAreaCalculator on the other. I only include the JTabbedPaneAssignment and DayGui classes here. I apologize if its too much code, I have trimmed off a lot of what I consider extraneous, but there may still be too much.</p>
  
  <p>Here is the calling class JTabbedPaneAssignment</p>
  
  <pre><code>import javax.swing.*;
  import java.awt.*;
  import java.awt.event.*;
  
  public class JTabbedPaneAssignment extends JPanel
  {
      public JTabbedPaneAssignment()
      {
          //super(new GridLayout(1, 1));
  
          JTabbedPane tabbedPane = new JTabbedPane();
          DayGui pnlDay = new DayGui();
          OfficeAreaCalculator  pnlOffice = new OfficeAreaCalculator ();
          this.add(tabbedPane);
  
          JPanel panel1 = new JPanel();
          JPanel panel2 = new JPanel();
          tabbedPane.add(panel1,"First panel");
          tabbedPane.add(panel2,"Second panel");
  
  
          //JComponent panel1 = makeTextPanel("Pane #1");
          panel1.setPreferredSize(new Dimension(300, 150));
          tabbedPane.addTab("DayGui", panel1);
          tabbedPane.setMnemonicAt(0, KeyEvent.VK_1);
  
          //JComponent panel2 = makeTextPanel("Pane #2");
          panel2.setPreferredSize(new Dimension(410, 50));
          tabbedPane.addTab("OfficeAreaCalculator", panel2);
          tabbedPane.setMnemonicAt(1, KeyEvent.VK_2);
          add(tabbedPane);
      }
  
      protected JComponent makeTextPanel(String text)
      {
          JPanel panel = new JPanel(false);
          JLabel filler = new JLabel(text);
          filler.setHorizontalAlignment(JLabel.CENTER);
          panel.setLayout(new GridLayout(1, 1));
          panel.add(filler);
          return panel;
      }
  
      // Create JTabbedPane
      private static void createAndShowGUI()
      {
          // Create and set up the window.
          JFrame frame = new JFrame("JTabbedPane");
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          frame.add(new JTabbedPaneAssignment(), BorderLayout.CENTER);
          JTabbedPane DayGui = new JTabbedPane();
          JTabbedPane OfficeAreaCalculator = new JTabbedPane();
          frame.pack();
          frame.setVisible(true);
      }
  
  
      public static void main(String[] args)
      {
          SwingUtilities.invokeLater(new Runnable()
          {
              public void run()
              {
                  createAndShowGUI();
              }
          });
      }
  }
  </code></pre>
  
  <p>Here is DayGui class. It started out as a JFrame, but I am trying to convert it to a JPanel. I think my issue is in this section of code, but I don't know</p>
  
  <pre><code>import java.awt.*;
  import java.awt.event.*;
  
  import javax.swing.*;
  
  //public class DayGui extends JPanel
  public class DayGui extends JPanel
  {
      private JPanel dayPanel;
      private JButton cmdGood;
      private JButton cmdBad;
  
      public DayGui()
      {
          //dayPanel = new JPanel("Messages");
  
          cmdGood = new JButton("Good");
          cmdBad = new JButton("Bad");
  
          Container c = dayPanel.getRootPane();
          c.setLayout(new FlowLayout());
  
          c.add(cmdGood);
          c.add(cmdBad);
  
          dayPanel.setSize(300, 150);
  
          ButtonsHandler bhandler = new ButtonsHandler();
          cmdGood.addActionListener(bhandler);
          cmdBad.addActionListener(bhandler);
  
          dayPanel.setVisible(true);
          dayPanel.getRootPane().setBackground(Color.CYAN);
  
      }
  
      class ButtonsHandler implements ActionListener
      {
          public void actionPerformed(ActionEvent e)
          {
              if (e.getSource() == cmdGood)
                  JOptionPane.showMessageDialog(null, "Today is a good day!",
                          "Event Handler Message",
                          JOptionPane.INFORMATION_MESSAGE);
              if (e.getSource() == cmdBad)
                  JOptionPane.showMessageDialog(null, "Today is a bad day!",
                          "Event Handler Message",
                          JOptionPane.INFORMATION_MESSAGE);
          }
      }
  
  }
  </code></pre>