< prev index next >

jdk/src/java.desktop/share/classes/java/awt/TextArea.java

Print this page

        

*** 325,337 **** @Deprecated public synchronized void insertText(String str, int pos) { TextAreaPeer peer = (TextAreaPeer)this.peer; if (peer != null) { peer.insert(str, pos); - } else { - text = text.substring(0, pos) + str + text.substring(pos); } } /** * Appends the given text to the text area's current text. * <p>Note that passing <code>null</code> or inconsistent --- 325,337 ---- @Deprecated public synchronized void insertText(String str, int pos) { TextAreaPeer peer = (TextAreaPeer)this.peer; if (peer != null) { peer.insert(str, pos); } + text = (text != null) ? text.substring(0, pos) + str + + text.substring(pos) : str; } /** * Appends the given text to the text area's current text. * <p>Note that passing <code>null</code> or inconsistent
*** 341,351 **** * @param str the non-<code>null</code> text to append * @see java.awt.TextArea#insert * @since 1.1 */ public void append(String str) { ! appendText(str); } /** * Appends the given text to the text area's current text. * --- 341,351 ---- * @param str the non-<code>null</code> text to append * @see java.awt.TextArea#insert * @since 1.1 */ public void append(String str) { ! insertText(str, getText().length()); } /** * Appends the given text to the text area's current text. *
*** 353,367 **** * @deprecated As of JDK version 1.1, * replaced by <code>append(String)</code>. */ @Deprecated public synchronized void appendText(String str) { - if (peer != null) { insertText(str, getText().length()); - } else { - text = text + str; - } } /** * Replaces text between the indicated start and end positions * with the specified replacement text. The text at the end --- 353,363 ----
*** 401,413 **** @Deprecated public synchronized void replaceText(String str, int start, int end) { TextAreaPeer peer = (TextAreaPeer)this.peer; if (peer != null) { peer.replaceRange(str, start, end); - } else { - text = text.substring(0, start) + str + text.substring(end); } } /** * Returns the number of rows in the text area. * @return the number of rows in the text area --- 397,409 ---- @Deprecated public synchronized void replaceText(String str, int start, int end) { TextAreaPeer peer = (TextAreaPeer)this.peer; if (peer != null) { peer.replaceRange(str, start, end); } + text = (text != null) ? text.substring(0, start) + str + + text.substring(end) : str; } /** * Returns the number of rows in the text area. * @return the number of rows in the text area
< prev index next >