< prev index next >
src/java.desktop/share/classes/java/awt/TextField.java
Print this page
@@ -157,10 +157,12 @@
/**
* Constructs a new text field initialized with the specified text.
* @param text the text to be displayed. If
* {@code text} is {@code null}, the empty
* string {@code ""} will be displayed.
+ * If {@code text} contains EOL character, then
+ * it will be replaced by space character.
* @exception HeadlessException if GraphicsEnvironment.isHeadless()
* returns true.
* @see java.awt.GraphicsEnvironment#isHeadless
*/
public TextField(String text) throws HeadlessException {
@@ -188,10 +190,12 @@
* number of columns. A column is an approximate average character
* width that is platform-dependent.
* @param text the text to be displayed. If
* {@code text} is {@code null}, the empty
* string {@code ""} will be displayed.
+ * If {@code text} contains EOL character, then
+ * it will be replaced by space character.
* @param columns the number of columns. If
* {@code columns} is less than {@code 0},
* {@code columns} is set to {@code 0}.
* @exception HeadlessException if GraphicsEnvironment.isHeadless()
* returns true.
@@ -291,11 +295,15 @@
}
/**
* Sets the text that is presented by this
* text component to be the specified text.
- * @param t the new text.
+ * @param t the new text. If
+ * {@code t} is {@code null}, the empty
+ * string {@code ""} will be displayed.
+ * If {@code t} contains EOL character, then
+ * it will be replaced by space character.
* @see java.awt.TextComponent#getText
*/
public void setText(String t) {
super.setText(replaceEOL(t));
< prev index next >