title: what changing my code from label to JLabel work?
body: <p>this is my origin code and it doesn't work:</p>
  
  <pre><code>//this code is to draw a panel and when you click "start", the Panel p2 changes color
  
        JFrame frm = new JFrame("1");
  
  
  frm.setBackground(new Color(150,130,110));
        frm.setSize(400,300);
        frm.setLocation(200,200); 
        Panel p1=new Panel();
        frm.add(p1,BorderLayout.NORTH);
        final Panel p2=new Panel();
        frm.add(p2,BorderLayout.EAST);
        Panel p3=new Panel();
        frm.add(p3,BorderLayout.CENTER);
        p1.setLayout(b2);
        p2.setLayout(b3);
        p3.setLayout(g1);
            });
        Label l1=new Label("max:"+sum);
        p2.add(l1,BorderLayout.NORTH);
        Label l2=new Label("blood:"+blood);
        p2.add(l2,BorderLayout.CENTER);
        bu1.setBackground(new Color(200,100,100));
        p2.setBackground(new Color(100,200,100));
        l1.setBackground(new Color(100,100,200));
  
  frm.setVisible(true);
  
      }
  
  }
  </code></pre>
  
  <p>and i find out that if i can make it work just by changing :</p>
  
  <pre><code>  JLabel l1=new JLabel("max:"+sum);
    p2.add(l1,BorderLayout.NORTH);
    JLabel l2=new JLabel("blood:"+blood);
  </code></pre>
  
  <p>can make it work,so i wonder why?</p>
  
  <p>is it related to the</p>
  
  <pre><code>  final Panel p2=new Panel();
  </code></pre>
  
  <p>or difference between swing and awt?</p>