title: how can I use  a variable in multiple jpanels?
body: <p>I have a frame with a var , I added that var to a JPanel, and if I want to add the same var to another JPanel, it`s disappearing from the first JPanel. I want a logical explanation for my problem please, thank you !
  I want to store my JLabel in both of my jpanels.</p>
  
  <pre><code>public class Gui {
      JPanel panel1, panel2;
      JLabel text = new JLabel("some text");
      JFrame frame = new JFrame();
  
      public Gui {
          panel1 = new JPanel();
          panel1.setLayout(null);
          panel1.add(text);
          panel1.getComponent(0).setBounds(50,50,50,50);
          panel1.setBorder(BorderFactory.createLineBorder(Color.black));
          panel1.setBounds(x,y,w,h);
          // it`s working, the labels it`s visible
  
          panel2 = new JPanel();
          panel2.setLayout(null);
          panel2.add(text);
          panel2.getComponent(0).setBounds(100,100,50,50);
          panel2.setBorder(BorderFactory.createLineBorder(Color.black));
          panel2.setBounds(x,y,w,h);
          //it`s not working, the label ins`t visible ...
  
          frame.add(panel1);
          frame.add(panel2);
      }
  }
  </code></pre>