title: JTextField listener when text changes that modifies textField's text
body: <p>Any idea how I can add a text listener on to a JTextField, that triggers when the text changes and as an action modifies the JTextField's text.</p>
  
  <p>I have tried using <code>addInputMethodListener</code> which seems to be appropriate but it doesn't seem to work. I have also tried <code>textField.getDocument().addDocumentListener()</code> but this throws <code>java.lang.IllegalStateException: Attempt to mutate in notification</code> when I try to modify textField's text.</p>