title: Disabling a button when two text fields are empty
body: <p>Okay so I want to disable a button when both tfLastName and tfFirstname are empty. I'm currently using this code snippet but it enables the button even if the tfLastName is empty. What do I do to solve this? Any input would be appreciated.</p>
  
  <pre><code>public void launchFrame(){
  //irrelevant code
  tfLastName.addKeyListener(null);
  tfFirstName.addKeyListener (new java.awt.event.KeyAdapter()
  {  
    public void keyReleased(java.awt.event.KeyEvent evt) 
            {  
              super.keyReleased(evt);
              if (tfFirst.getText().length() &gt; 0 &amp;&amp; tfLast.getText().length() &gt; 0) 
              {  
                  bAdd.setEnabled(true);  
              } else 
              {  
                  bAdd.setEnabled(false);  
              }  
          }  
  });
  }
  </code></pre>