title: Add Multiple JPanels to JFrame
body: <p>Been having a hard time adding JPanels to JFrame. Am pretty much new on java, always used C++
  I need to do 4 Panels inside one Frame. </p>
  
  <p>Here is my Code, just started today..</p>
  
  <pre><code>package project2;
  import javax.swing.JOptionPane;    
  import java.awt.FlowLayout;   
  import javax.swing.JFrame;    
  import javax.swing.JLabel;   
  import javax.swing.JPanel;   
  import javax.swing.SwingConstants; 
  import java.awt.Color;   
  import java.awt.GridLayout;   
  import java.awt.BorderLayout;   
  import javax.swing.*;  
  import java.awt.Container;  
  import java.awt.Dimension;
  
  public class GUI extends JFrame 
  {
      private JPanel Checks; //Panel to Hold Checks
      private JPanel Transactions;
      private JPanel History;
      private JPanel Graphics;
      private JLabel CLabel;
  
  
      public GUI()
      {
          super ( "UTB Check-In");
          JPanel Checks = new JPanel(); //set up panel
          CLabel = new JLabel("Label with text");
          Checks.setBackground(Color.red);
          Checks.setLayout( new BoxLayout(Checks,BoxLayout.LINE_AXIS)); 
          add(Checks);
  
  
        // JPanel Transactions = new JPanel();
         // Transactions.setToolTipText("Electronic Transactions");
          //Transactions.setBackground(Color.blue);
         // add(Transactions);
  
      }
  
  }
  </code></pre>
  
  <p>I was trying to put Transaction and Checks one side from the other with different colors,in this case blue and red it doesnt stay in the middle it those one or the other.
  One of my Colleagues told me that the BoxLayout(or any layout) needed to be implemented with the size..something to that extend. am not really sure I been reading 
  <a href="http://docs.oracle.com/javase/tutorial/uiswing/layout/box.html" rel="nofollow">http://docs.oracle.com/javase/tutorial/uiswing/layout/box.html</a></p>
  
  <p>But I still do not get it completely. If somebody can help me out 
  thanks!</p>