OSDN Git Service

Imported GNU Classpath 0.20
[pf3gnuchains/gcc-fork.git] / libjava / classpath / javax / swing / JTextField.java
index 8dc2f25..c490310 100644 (file)
@@ -203,9 +203,22 @@ public class JTextField extends JTextComponent
    */
   protected Document createDefaultModel()
   {
-    PlainDocument doc = new PlainDocument();
+    return new PlainDocument();
+  }
+
+  /**
+   * Sets the document to be used for this JTextField.
+   *
+   * This sets the document property <code>filterNewlines</code> to
+   * <code>true</code> and then calls the super behaviour to setup a view and
+   * revalidate the text field.
+   *
+   * @param doc the document to set
+   */
+  public void setDocument(Document doc)
+  {
     doc.putProperty("filterNewlines", Boolean.TRUE);
-    return doc;
+    super.setDocument(doc);
   }
 
   /**