title: How to assign value to this function in java incompatible types
body: <p>How to assign value to this function in Java incompatible types?</p>
  
  <pre><code>public class CustomerInfo implements Serializable {
  
      private static final long serialVersionUID = 9083257536541L;
      protected String id;
      protected String searchkey;
      protected String taxid;
      protected String name;
      protected String postal;
  
      /** Creates a new instance of UserInfoBasic */
      public CustomerInfo(String id) {
          this.id = id;
          this.searchkey = null;
          this.taxid = null;
          this.name = null;
          this.postal = null;
      }
  
      public String getId() {
          return id;
      }    
  
      public String getTaxid() {
          return taxid;
      }    
  
      public void setTaxid(String taxid) {
          this.taxid = taxid;
      }
  
      public String getSearchkey() {
          return searchkey;
      }
  
      public void setSearchkey(String searchkey) {
          this.searchkey = searchkey;
      }
  
      public String getName() {
          return name;
      }   
  
      public void setName(String name) {
          this.name = name;
      }
  
      public String getPostal() {
          return postal;
      }   
  
      public void setPostal(String postal) {
          this.postal = postal;
      }    
  
      public String printTaxid() {
          return StringUtils.encodeXML(taxid);
      }
  
      public String printName() {
          return StringUtils.encodeXML(name);
      }
  
      @Override
      public String toString() {
          return getName();
      }    
  }
  
    private CustomerInfo selectedCustomer;
  
    public CustomerInfo getSelectedCustomer() {
          // construct a CustomerInfo from the data in your String
  
          return selectedCustomer;
      }
  
  
   private void jcmdOKActionPerformed(java.awt.event.ActionEvent evt) { 
  
             selectedCustomer = (CustomerInfo) jListCustomers.getSelectedValue();
              //test code
              String testing  = m_jtxtName.getText();
                System.out.println("Now the selectedCustomer is dispayed!");
              System.out.println(selectedCustomer);
               System.out.println(testing);
         //test code
              dispose();       
          }
  </code></pre>
  
  <p>In the above shown code, I need the string testing value to be assigned to <code>selectedCustomer</code>. How can I assign the value? This is the error I get:</p>
  
  <pre><code>selectedCustomer = m_jtxtName.getText();
  
  incompatible types
      required: CustomerInfo
      found:    String
  </code></pre>