title: Adding two panels to a JFrame in Java
body: <p>So what I'm trying to do is have 2 panels (it has to be panels) inside of a JFrame and have 1 a certain size, the other a smaller size and having the smaller sized one painted a certain color.</p>
  
  <pre><code>public class Binary{
  
  private JLabel header;
  private JTextField userInput1;
  private JButton doIt;
  private JButton clear;
  private JRadioButton binary, decimal;
  private JLabel number2;
  private JFrame frame1;
  private JPanel panel1;
  private JPanel panel2;
  
  public Binary(){
  
      frame1 = new JFrame("Number Converter"); // frame 
      frame1.setLayout(new FlowLayout());
      frame1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  
      panel1 = new JPanel(); // first panel (light grey)
      panel1.setSize(250, 475);
      frame1.add(panel1);
  
      header = new JLabel("1- Select the mode: ");
      panel1.add(header);
  
      ButtonGroup choices= new ButtonGroup();
      binary = new JRadioButton("Binary to Decimal"); // add the first radiobutton binary to decimal
      choices.add(binary);
      decimal = new JRadioButton("Decimal to Binary"); // add the second radiobutton decimal to binary
      choices.add(decimal);
      frame1.add(binary); // adds both to the program
      frame1.add(decimal);
  
      userInput1 = new JTextField(20); // Adds a blank text field for user input
      frame1.add(userInput1);
  
      number2 = new JLabel("2- Enter some words then click Do It:"); 
      frame1.add(number2);
  
      panel2 = new JPanel(); // second panel, bottom dark grey
      panel2.setOpaque(true);
      panel2.setBackground(Color.GRAY);
      panel2.setSize(500, 500);
      frame1.add(panel2);
  
      doIt = new JButton("Do It"); // left button do it
      frame1.add(doIt);
  
      clear = new JButton("Clear"); // right button clear
      frame1.add(clear);
  
      frame1.setSize(250, 500);
      frame1.setVisible(true);
  }
  </code></pre>
  
  <p>}</p>
  
  <p>For some reason, my code here basically outputs a minuscule panel on top of my first panel.
  Is there something I'm missing?</p>