title: How to create a JPanel inside a Jframe?
body: <p>I have a class that extends JFrame that has a menubar and menu Items inside of it. Under the menu bar I want to add a JPanel where I can add components and draw shapes.How would I add a JPanel inside of this class? Sorry if this is an easy question I am a beginner.</p>
  
  <pre><code>import java.awt.FlowLayout;
  
  import javax.swing.*;
  
  public class theMenu extends JFrame {
  
    static JMenuBar menubar;
      JMenu shape, color;
      JCheckBox fill;
      JButton btn1,btn2;
      JMenuItem circle, rectangle, line,triangle;
      JMenuItem red, green, blue, yellow;
  
   public theMenu(){
    super("Using JMenus");     
    menubar=new JMenuBar ();
    shape=new JMenu ("Shape");
    add(menubar);
    setJMenuBar(menubar); // add menu bar to application
    shape=new JMenu ("Shape");
    color=new JMenu ("Color");
    fill=new JCheckBox("fill");
    btn1=new JButton("save");
    btn2=new JButton("import");
    circle=new JMenuItem ("Circle");
    rectangle=new JMenuItem ("Rectangle");
    line=new JMenuItem ("Line");
    triangle = new JMenuItem ("Triangle");
    red=new JMenuItem ("Red");
    green=new JMenuItem ("Green");
    blue=new JMenuItem ("Blue");
    yellow=new JMenuItem ("Yellow");
  
    shape.add (circle);
    shape.add (rectangle);
    shape.add (line);
    shape.add (triangle);
  
    color.add (red);
    color.add (green);
    color.add (blue);
    color.add (yellow);
  
    menubar.add (shape);
    menubar.add(color);
    menubar.add(fill);
    menubar.add(btn1);
    menubar.add(btn2);
   }
  }
  </code></pre>