diff options
Diffstat (limited to 'libjava/classpath/javax/swing/JTextField.java')
-rw-r--r-- | libjava/classpath/javax/swing/JTextField.java | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/libjava/classpath/javax/swing/JTextField.java b/libjava/classpath/javax/swing/JTextField.java index 8dc2f256914..c4903106131 100644 --- a/libjava/classpath/javax/swing/JTextField.java +++ b/libjava/classpath/javax/swing/JTextField.java @@ -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); } /** |