title: Java - GUI Add the same button to two different panels
body: <pre><code>public class Test extends JFrame {
      public Test() {
          JButton jbt1 = new JButton("Java");
          JButton jbt2 = new JButton("Programming");
          JPanel p1 = new JPanel();
          JPanel p2 = new JPanel();
          JPanel p3 = new JPanel();
          p1.add(jbt1);
          p2.add(jbt2);
          p3.add(jbt1);
  
          add(p1, BorderLayout.NORTH);
          add(p2, BorderLayout.SOUTH);
          add(p3, BorderLayout.CENTER);
      }
      public void main(String[] args) {
          Test f = new Test();
          f.setVisible(true);
      }
  }
  </code></pre>
  
  <p>The output is:</p>
  
  <p>Java</p>
  
  <h2>Programming</h2>
  
  <p>What I am expecting:</p>
  
  <p>Java</p>
  
  <p>Java</p>
  
  <h2>Programming</h2>
  
  <p>WHY???????Where is jbt1 in p3 ??</p>