title: can't clear jtextfield using Documentlistener
body: <p>i have a textfield, when the user inserts a certain number of characters the program should put it in a JTable and clears the textfield, but it fires an event for <code>Jtextfield.setText("");</code></p>
  
  <p>Here's my code:</p>
  
  <pre><code>jTextField2.getDocument().addDocumentListener(new DocumentListener() {
  
          @Override
          public void insertUpdate(DocumentEvent e) {
              printIt();
          }
  
          @Override
          public void removeUpdate(DocumentEvent e) {
  
          }
  
          @Override
          public void changedUpdate(DocumentEvent e) {
  
          }
  
          private void printIt() {
              //DocumentEvent.EventType type = documentEvent.getType();
              String code=jTextField2.getText().trim();
  
             // if(type.toString().trim().length()==13)
              if (code.length()==4) {
                     list.add(code);
                     mod.addRow(new Object[]{code});
                     jTextField2.setText(""); 
              }
          }
      });
  }
  </code></pre>