title: Textfield1 Same text Display on Textfield2 in Java
body: <p>When i type the text on textfield1 same text need to be display on textfield2 in  java. i tried but i couldn't do it. if i remove the text on textfield1 same text should remove on textfield2.what i tried already so far i attached below.</p>
  
  <p><strong>this is code i tried</strong> </p>
  
  <pre><code> private void txtnameFocusGained(java.awt.event.FocusEvent evt) {                                    
  
          String name = txtname.getText();
          txtname2.setText(name);
  
      }   
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/n5evU.jpg" rel="nofollow noreferrer">enter image description here</a> </p>