title: java enable the second textfield if the first textfield is not empty
body: <p>I have 2 textfields in my project. The first textfield is txtNumA and the second is txtNumB. I disabled txtNumB. When txtNumA is not empty, txtNumB will be enabled. </p>
  
  <p>Well, this is part of code I've tried:</p>
  
  <pre><code>private void txtNumKeyTyped(java.awt.event.KeyEvent evt) {                                   
      if(!(txtNumA.getText().trim().equals(""))){  
          txtNumB.setEnabled(true); 
      }
      else { 
          txtNumB.setText(null);
          txtNumB.setEnabled(false);
      } 
  }
  </code></pre>
  
  <p>Actually it works, but not perfect. It works only if I typed 2 or more characters in txtNumA. What I need is when I typed one character and more, txtNumB will be enabled. </p>
  
  <p>What's wrong with my code? </p>