title: java - Cant change the value of a JTextfield from inside of DocumentListener methods
body: <p>I get an "Attempt to mutate in notification" exception.
  1. How can I change it ? 
  2. How can I get the value that was inside the TextField before the listener was triggered?</p>
  
  <p>EDIT:</p>
  
  <p>It is something like this. On the JTextfield I have this listener  </p>
  
  <pre><code>basePriceTF.getDocument().addDocumentListener(new DocumentListener(){ 
       public void insertUpdate(DocumentEvent e){ 
          if (Integer.getValue(basePriceTF.getText())&lt;0){
          basePriceTF.setText("0");
          }
       }
  
       public void removeUpdate(DocumentEvent e){/**my implemntation**/}
  
       public void changedUpdate(DocumentEvent e){/**my implemntation**/}
  }
  
  insertUpdate() will probably cause a loop.
  So it doesnt let me change inside basePriceTF.
  </code></pre>