title: how to get values in other class?
body: <p>I have JFrame named "Login" and another JPanel  "AddItemJpanel".
  So i want to use user login name to AddItemJpanel.
  here's how i tried bt it dosnt pass any values.</p>
  
  <pre><code>public class login{
  
  public String getUserName() {
          String n=txtUserName.getText();
          return n;
      }
  }
  </code></pre>
  
  <p>and this is my another Jpanel code for get user name and want to set it to jLabel.and i have called this method name in costructer.</p>
  
  <pre><code>public void setNameToInvoice(){
             Login l = new Login();
             String n = l.getUserName();
             lblCustomerName.setText(n);
  }
  </code></pre>
  
  <p>Can some one please help me to do this?</p>