title: JTextField setDocument overwrites text
body: <p>I created a JTextField (either with setting the text after the creation or in the constructor). After that I added a Document (setDocument) to the textfield and wondered why the text value of JTextField was empty.</p>
  
  <p>Example:</p>
  
  <pre><code>JTextField field = new JTextField();
  field.setText(textValue); // or instead setting the text in the constructor
  field.setDocument(new TestDocument());
  // text is no empty
  </code></pre>
  
  <p>Setting the document before the text fixes this entirely. I just wondered why this happens. Is it because the previously set text wasn't handled according to document?</p>