本文整理汇总了Java中java.awt.peer.TextComponentPeer.getText方法的典型用法代码示例。如果您正苦于以下问题:Java TextComponentPeer.getText方法的具体用法?Java TextComponentPeer.getText怎么用?Java TextComponentPeer.getText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.peer.TextComponentPeer
的用法示例。
在下文中一共展示了TextComponentPeer.getText方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: writeObject
import java.awt.peer.TextComponentPeer; //导入方法依赖的package包/类
/**
* Writes default serializable fields to stream. Writes
* a list of serializable TextListener(s) as optional data.
* The non-serializable TextListener(s) are detected and
* no attempt is made to serialize them.
*
* @serialData Null terminated sequence of zero or more pairs.
* A pair consists of a String and Object.
* The String indicates the type of object and
* is one of the following :
* textListenerK indicating and TextListener object.
*
* @see AWTEventMulticaster#save(ObjectOutputStream, String, EventListener)
* @see java.awt.Component#textListenerK
*/
private void writeObject(java.io.ObjectOutputStream s)
throws IOException
{
// Serialization support. Since the value of the fields
// selectionStart, selectionEnd, and text aren't necessarily
// up to date, we sync them up with the peer before serializing.
TextComponentPeer peer = (TextComponentPeer)this.peer;
if (peer != null) {
text = peer.getText();
selectionStart = peer.getSelectionStart();
selectionEnd = peer.getSelectionEnd();
}
s.defaultWriteObject();
AWTEventMulticaster.save(s, textListenerK, textListener);
s.writeObject(null);
}
示例2: setText
import java.awt.peer.TextComponentPeer; //导入方法依赖的package包/类
/**
* Sets the text that is presented by this
* text component to be the specified text.
* @param t the new text;
* if this parameter is {@code null} then
* the text is set to the empty string ""
* @see java.awt.TextComponent#getText
*/
public synchronized void setText(String t) {
if (t == null) {
t = "";
}
TextComponentPeer peer = (TextComponentPeer)this.peer;
if (peer != null) {
text = peer.getText();
// Please note that we do not want to post an event
// if TextArea.setText() or TextField.setText() replaces text
// by same text, that is, if component's text remains unchanged.
if (!t.equals(text)) {
text = t;
peer.setText(text);
}
} else {
text = t;
}
}
示例3: writeObject
import java.awt.peer.TextComponentPeer; //导入方法依赖的package包/类
/**
* Writes default serializable fields to stream. Writes
* a list of serializable TextListener(s) as optional data.
* The non-serializable TextListener(s) are detected and
* no attempt is made to serialize them.
*
* @serialData Null terminated sequence of zero or more pairs.
* A pair consists of a String and Object.
* The String indicates the type of object and
* is one of the following :
* textListenerK indicating and TextListener object.
*
* @see AWTEventMulticaster#save(ObjectOutputStream, String, EventListener)
* @see java.awt.Component#textListenerK
*/
private void writeObject(java.io.ObjectOutputStream s)
throws IOException
{
// Serialization support. Since the value of the fields
// selectionStart, selectionEnd, and text aren't necessarily
// up to date, we sync them up with the peer before serializing.
TextComponentPeer peer = (TextComponentPeer)this.peer;
if (peer != null) {
text = peer.getText();
selectionStart = peer.getSelectionStart();
selectionEnd = peer.getSelectionEnd();
}
s.defaultWriteObject();
AWTEventMulticaster.save(s, textListenerK, textListener);
s.writeObject(null);
}
示例4: removeNotify
import java.awt.peer.TextComponentPeer; //导入方法依赖的package包/类
/**
* Removes the <code>TextComponent</code>'s peer.
* The peer allows us to modify the appearance of the
* <code>TextComponent</code> without changing its
* functionality.
*/
public void removeNotify() {
synchronized (getTreeLock()) {
TextComponentPeer peer = (TextComponentPeer)this.peer;
if (peer != null) {
text = peer.getText();
selectionStart = peer.getSelectionStart();
selectionEnd = peer.getSelectionEnd();
}
super.removeNotify();
}
}
示例5: getText
import java.awt.peer.TextComponentPeer; //导入方法依赖的package包/类
/**
* Returns the text that is presented by this text component.
* By default, this is an empty string.
*
* @return the value of this <code>TextComponent</code>
* @see java.awt.TextComponent#setText
*/
public synchronized String getText() {
TextComponentPeer peer = (TextComponentPeer)this.peer;
if (peer != null) {
text = peer.getText();
}
return text;
}
示例6: removeNotify
import java.awt.peer.TextComponentPeer; //导入方法依赖的package包/类
/**
* Removes the {@code TextComponent}'s peer.
* The peer allows us to modify the appearance of the
* {@code TextComponent} without changing its
* functionality.
*/
public void removeNotify() {
synchronized (getTreeLock()) {
TextComponentPeer peer = (TextComponentPeer)this.peer;
if (peer != null) {
text = peer.getText();
selectionStart = peer.getSelectionStart();
selectionEnd = peer.getSelectionEnd();
}
super.removeNotify();
}
}
示例7: getText
import java.awt.peer.TextComponentPeer; //导入方法依赖的package包/类
/**
* Returns the text that is presented by this text component.
* By default, this is an empty string.
*
* @return the value of this {@code TextComponent}
* @see java.awt.TextComponent#setText
*/
public synchronized String getText() {
TextComponentPeer peer = (TextComponentPeer)this.peer;
if (peer != null) {
text = peer.getText();
}
return text;
}
示例8: getText
import java.awt.peer.TextComponentPeer; //导入方法依赖的package包/类
/**
* Returns the text in this component
*
* @return The text in this component.
*/
public synchronized String getText()
{
TextComponentPeer tcp = (TextComponentPeer) getPeer();
if (tcp != null)
text = tcp.getText();
return(text);
}
示例9: removeNotify
import java.awt.peer.TextComponentPeer; //导入方法依赖的package包/类
/**
* Removes the <code>TextComponent</code>'s peer.
* The peer allows us to modify the appearance of the
* <code>TextComponent</code> without changing its
* functionality.
*/
public void removeNotify() {
synchronized (getTreeLock()) {
TextComponentPeer peer = (TextComponentPeer)this.peer;
if (peer != null) {
text = peer.getText();
selectionStart = peer.getSelectionStart();
selectionEnd = peer.getSelectionEnd();
}
super.removeNotify();
}
}
示例10: getText
import java.awt.peer.TextComponentPeer; //导入方法依赖的package包/类
/**
* Returns the text that is presented by this text component.
* By default, this is an empty string.
*
* @return the value of this <code>TextComponent</code>
* @see java.awt.TextComponent#setText
*/
public synchronized String getText() {
TextComponentPeer peer = (TextComponentPeer)this.peer;
if (peer != null) {
text = peer.getText();
}
return text;
}