本文整理汇总了Java中java.awt.peer.TextAreaPeer.replaceRange方法的典型用法代码示例。如果您正苦于以下问题:Java TextAreaPeer.replaceRange方法的具体用法?Java TextAreaPeer.replaceRange怎么用?Java TextAreaPeer.replaceRange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.peer.TextAreaPeer
的用法示例。
在下文中一共展示了TextAreaPeer.replaceRange方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: replaceText
import java.awt.peer.TextAreaPeer; //导入方法依赖的package包/类
/**
* @deprecated As of JDK version 1.1,
* replaced by <code>replaceRange(String, int, int)</code>.
*/
@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);
}
示例2: replaceText
import java.awt.peer.TextAreaPeer; //导入方法依赖的package包/类
/**
* Replace a range of characters with the specified text. The
* character at the start position will be replaced, unless start ==
* end. The character at the end posistion will not be replaced.
* The first character in the text area is at position zero. The
* length of the replacement text may differ from the length of the
* text that is replaced.
*
* @param str The new text for the range.
* @param start The start position of the replacement range.
* @param end The end position of the replacement range.
*
* @deprecated This method is deprecated in favor of
* <code>replaceRange ()</code>.
*/
public void replaceText (String str, int start, int end)
{
String tmp1 = null;
String tmp2 = null;
TextAreaPeer peer = (TextAreaPeer) getPeer();
if (peer != null)
peer.replaceRange(str, start, end);
else
{
tmp1 = getText().substring(0, start);
tmp2 = getText().substring(end, getText().length());
setText(tmp1 + str + tmp2);
}
}
示例3: replaceText
import java.awt.peer.TextAreaPeer; //导入方法依赖的package包/类
/**
* @deprecated As of JDK version 1.1,
* replaced by <code>replaceRange(String, int, int)</code>.
*/
@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);
}
}
示例4: replaceText
import java.awt.peer.TextAreaPeer; //导入方法依赖的package包/类
/**
* Replaces a range of characters between
* the indicated start and end positions
* with the specified replacement text (the text at the end
* position will not be replaced).
*
* @param str the non-{@code null} text to use as
* the replacement
* @param start the start position
* @param end the end position
* @deprecated As of JDK version 1.1,
* replaced by {@code replaceRange(String, int, int)}.
*/
@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);
}