title: Documentlistener to check wether my textfield is empty or not
body: <p>I have a button that is disabled at default. I want the button enabled when my textfield is no longer empty. I'm trying to use a <code>documentlistener</code> but it gives the following error: </p>
  
  <pre><code>method addDocumentListener in interface javax.swing.text.Document cannot be applied to given types;
    required: javax.swing.event.DocumentListener
    found: &lt;anonymous DocumentListener&gt;
    reason: actual argument &lt;anonymous DocumentListener&gt; cannot be converted to javax.swing.event.DocumentListener by method invocation conversion
  </code></pre>
  
  <p>Here is my code:</p>
  
  <pre><code>    private void tekstveldActionPerformed(java.awt.event.ActionEvent evt) {
  
      tekstveld.getDocument().addDocumentListener(new DocumentListener(){
          public void changedUpdate(DocumentEvent e) {
              changed();
          }
          public void removeUpdate(DocumentEvent e) {
              changed();
          }
          public void insertUpdate(DocumentEvent e) {
              changed();
          }
  
          public void changed(){
              if (tekstveld.getText().equals("")){
                  leegmaken.setEnabled(false);
              }else{
                  leegmaken.setEnabled(true);
              }
          }
  
      });        
  }
  </code></pre>