< 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,336 ----
@Deprecated
public synchronized void insertText(String str, int pos) {
TextAreaPeer peer = (TextAreaPeer)this.peer;
if (peer != null) {
peer.insert(str, pos);
}
+ 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
*** 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
--- 352,362 ----
*** 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
--- 396,407 ----
@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.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
< prev index next >