title: Create JPanel with component in it
body: <p>I am trying to create JPanel having some JLabels in it, to which I want to pass value by constructor of JPanel.
  As below.</p>
  
  <pre><code>class MyPanel extends JPanel
   {
  
   private JLabel lbl;
  
       public MyPanel(String val)
  {
     super();
     lbl=new JLabel(val);
     this.add(lbl);
  }
   } 
  </code></pre>
  
  <p>And while using this Panel <code>MyPanel mp=new MyPanel("value");</code></p>
  
  <p>But I am not able to see the Label inside the Panel.</p>
  
  <p>What may be the problem?
  Is there any other way to do this?</p>