title: How do I create bordered color style panel?
body: <p>I'm trying to create a canvas for my oval shape, and I want it to be different from the main <code>JFrame</code> color. So far, using <code>setSize</code> upon the panel doesn't work, it ended up creating a small box that I couldn't draw in. Here is the panel design that I intended it to be, with the white-colored part as the main frame. </p>
  
  <p>PanelDesign</p>
  
  <p><img src="https://i.stack.imgur.com/rK3xF.jpg"></p>
  
  <p>As I've said, using all three Layout modes (<code>Border</code>, <code>Flow</code>, and <code>Grid</code>) only creates a yellow small box in the upper middle part of the frame. This is the code that I use. </p>
  
  <p>How can I create the panel design similar to the image posted above? </p>
  
  <pre><code>    setTitle("Oval Shape Mover");
      setSize(500, 200);
      setLayout(new BorderLayout());
      JPanel mainpanel, panel1, panel2;
  
      mainpanel = new JPanel();
      panel1 = new JPanel();
      panel2 = new JPanel();
  
      panel1.setBackground(Color.YELLOW);
      mainpanel.add(panel1, BorderLayout.CENTER);
      mainpanel.add(panel2);
      add(mainpanel);
      setVisible(true);
  </code></pre>