title: Set JPanel's size doesn't depend on JFrame 's size
body: <p>My project have an JPanel and JFrame, (JPanel in JFrame).
  I set  JFrame ' s size is (400,400). And the size of JPanel is (150,150). I add JPanel to JFrame and run it, when it displayed, the size of JPanel not is 150, it's size is same the size of JFrame. I don't know how to fix it :(</p>
  
  <p>How to set JPanel's size doesn't depend on JFrame 's size?</p>
  
  <p>Here my code:</p>
  
  <pre><code>public class Draw_JPanel extends JFrame{
  Load_image panel_im = new Load_image();
  public Draw_JPanel()
  {       
      this.setSize(400,400);
      this.add(panel_im);
      }   
  public static void main(String[] args){
      Draw_JPanel abc = new Draw_JPanel();
  
      abc.setVisible(true);
      }
  }
  </code></pre>
  
  <p>and my Load_image class:</p>
  
  <pre><code>public class Load_image extends JPanel{
  public Load_image()
  {
      setSize(30,30);     
      this.setBackground(Color.RED);
  }
  }
  </code></pre>