本文整理汇总了Java中java.awt.peer.LabelPeer.setText方法的典型用法代码示例。如果您正苦于以下问题:Java LabelPeer.setText方法的具体用法?Java LabelPeer.setText怎么用?Java LabelPeer.setText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.peer.LabelPeer
的用法示例。
在下文中一共展示了LabelPeer.setText方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setText
import java.awt.peer.LabelPeer; //导入方法依赖的package包/类
/**
* Sets the text for this label to the specified text.
* @param text the text that this label displays. If
* <code>text</code> is <code>null</code>, it is
* treated for display purposes like an empty
* string <code>""</code>.
* @see java.awt.Label#getText
*/
public void setText(String text) {
boolean testvalid = false;
synchronized (this) {
if (text != this.text && (this.text == null ||
!this.text.equals(text))) {
this.text = text;
LabelPeer peer = (LabelPeer)this.peer;
if (peer != null) {
peer.setText(text);
}
testvalid = true;
}
}
// This could change the preferred size of the Component.
if (testvalid) {
invalidateIfValid();
}
}
示例2: setText
import java.awt.peer.LabelPeer; //导入方法依赖的package包/类
/**
* Sets the text for this label to the specified text.
* @param text the text that this label displays. If
* {@code text} is {@code null}, it is
* treated for display purposes like an empty
* string {@code ""}.
* @see java.awt.Label#getText
*/
public void setText(String text) {
boolean testvalid = false;
synchronized (this) {
if (text != this.text && (this.text == null ||
!this.text.equals(text))) {
this.text = text;
LabelPeer peer = (LabelPeer)this.peer;
if (peer != null) {
peer.setText(text);
}
testvalid = true;
}
}
// This could change the preferred size of the Component.
if (testvalid) {
invalidateIfValid();
}
}
示例3: setText
import java.awt.peer.LabelPeer; //导入方法依赖的package包/类
/**
* Sets the text in this label to the specified value.
*
* @param text The new text for this label.
*/
public synchronized void setText(String text)
{
if ((this.text == null && text != null)
|| (this.text != null && ! this.text.equals(text)))
{
this.text = text;
if (peer != null)
{
LabelPeer lp = (LabelPeer) peer;
lp.setText(text);
}
invalidate();
}
}
示例4: setText
import java.awt.peer.LabelPeer; //导入方法依赖的package包/类
/**
* Sets the text for this label to the specified text.
* @param text the text that this label displays. If
* <code>text</code> is <code>null</code>, it is
* treated for display purposes like an empty
* string <code>""</code>.
* @see java.awt.Label#getText
*/
public void setText(String text) {
boolean testvalid = false;
synchronized (this) {
if (text != this.text && (this.text == null ||
!this.text.equals(text))) {
this.text = text;
LabelPeer peer = (LabelPeer)this.peer;
if (peer != null) {
peer.setText(text);
}
testvalid = true;
}
}
// This could change the preferred size of the Component.
if (testvalid && valid) {
invalidate();
}
}