Java Code Examples for java.awt.peer.TextComponentPeer#setText()

The following examples show how to use java.awt.peer.TextComponentPeer#setText() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TextComponent.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
/**
 * 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;
    }
}
 
Example 2
Source File: TextComponent.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
    }
}
 
Example 3
Source File: TextComponent.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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</code> then
 *                  the text is set to the empty string ""
 * @see         java.awt.TextComponent#getText
 */
public synchronized void setText(String t) {
    boolean skipTextEvent = (text == null || text.isEmpty())
            && (t == null || t.isEmpty());
    text = (t != null) ? t : "";
    TextComponentPeer peer = (TextComponentPeer)this.peer;
    // Please note that we do not want to post an event
    // if TextArea.setText() or TextField.setText() replaces an empty text
    // by an empty text, that is, if component's text remains unchanged.
    if (peer != null && !skipTextEvent) {
        peer.setText(text);
    }
}
 
Example 4
Source File: TextComponent.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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</code> then
 *                  the text is set to the empty string ""
 * @see         java.awt.TextComponent#getText
 */
public synchronized void setText(String t) {
    boolean skipTextEvent = (text == null || text.isEmpty())
            && (t == null || t.isEmpty());
    text = (t != null) ? t : "";
    TextComponentPeer peer = (TextComponentPeer)this.peer;
    // Please note that we do not want to post an event
    // if TextArea.setText() or TextField.setText() replaces an empty text
    // by an empty text, that is, if component's text remains unchanged.
    if (peer != null && !skipTextEvent) {
        peer.setText(text);
    }
}
 
Example 5
Source File: TextComponent.java    From jdk-1.7-annotated with Apache License 2.0 5 votes vote down vote up
/**
 * 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</code> then
 *                  the text is set to the empty string ""
 * @see         java.awt.TextComponent#getText
 */
public synchronized void setText(String t) {
    boolean skipTextEvent = (text == null || text.isEmpty())
            && (t == null || t.isEmpty());
    text = (t != null) ? t : "";
    TextComponentPeer peer = (TextComponentPeer)this.peer;
    // Please note that we do not want to post an event
    // if TextArea.setText() or TextField.setText() replaces an empty text
    // by an empty text, that is, if component's text remains unchanged.
    if (peer != null && !skipTextEvent) {
        peer.setText(text);
    }
}
 
Example 6
Source File: TextComponent.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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</code> then
 *                  the text is set to the empty string ""
 * @see         java.awt.TextComponent#getText
 */
public synchronized void setText(String t) {
    boolean skipTextEvent = (text == null || text.isEmpty())
            && (t == null || t.isEmpty());
    text = (t != null) ? t : "";
    TextComponentPeer peer = (TextComponentPeer)this.peer;
    // Please note that we do not want to post an event
    // if TextArea.setText() or TextField.setText() replaces an empty text
    // by an empty text, that is, if component's text remains unchanged.
    if (peer != null && !skipTextEvent) {
        peer.setText(text);
    }
}
 
Example 7
Source File: TextComponent.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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</code> then
 *                  the text is set to the empty string ""
 * @see         java.awt.TextComponent#getText
 */
public synchronized void setText(String t) {
    boolean skipTextEvent = (text == null || text.isEmpty())
            && (t == null || t.isEmpty());
    text = (t != null) ? t : "";
    TextComponentPeer peer = (TextComponentPeer)this.peer;
    // Please note that we do not want to post an event
    // if TextArea.setText() or TextField.setText() replaces an empty text
    // by an empty text, that is, if component's text remains unchanged.
    if (peer != null && !skipTextEvent) {
        peer.setText(text);
    }
}
 
Example 8
Source File: TextComponent.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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</code> then
 *                  the text is set to the empty string ""
 * @see         java.awt.TextComponent#getText
 */
public synchronized void setText(String t) {
    boolean skipTextEvent = (text == null || text.isEmpty())
            && (t == null || t.isEmpty());
    text = (t != null) ? t : "";
    TextComponentPeer peer = (TextComponentPeer)this.peer;
    // Please note that we do not want to post an event
    // if TextArea.setText() or TextField.setText() replaces an empty text
    // by an empty text, that is, if component's text remains unchanged.
    if (peer != null && !skipTextEvent) {
        peer.setText(text);
    }
}
 
Example 9
Source File: TextComponent.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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</code> then
 *                  the text is set to the empty string ""
 * @see         java.awt.TextComponent#getText
 */
public synchronized void setText(String t) {
    boolean skipTextEvent = (text == null || text.isEmpty())
            && (t == null || t.isEmpty());
    text = (t != null) ? t : "";
    TextComponentPeer peer = (TextComponentPeer)this.peer;
    // Please note that we do not want to post an event
    // if TextArea.setText() or TextField.setText() replaces an empty text
    // by an empty text, that is, if component's text remains unchanged.
    if (peer != null && !skipTextEvent) {
        peer.setText(text);
    }
}
 
Example 10
Source File: TextComponent.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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</code> then
 *                  the text is set to the empty string ""
 * @see         java.awt.TextComponent#getText
 */
public synchronized void setText(String t) {
    boolean skipTextEvent = (text == null || text.isEmpty())
            && (t == null || t.isEmpty());
    text = (t != null) ? t : "";
    TextComponentPeer peer = (TextComponentPeer)this.peer;
    // Please note that we do not want to post an event
    // if TextArea.setText() or TextField.setText() replaces an empty text
    // by an empty text, that is, if component's text remains unchanged.
    if (peer != null && !skipTextEvent) {
        peer.setText(text);
    }
}
 
Example 11
Source File: TextComponent.java    From Java8CN with Apache License 2.0 5 votes vote down vote up
/**
 * 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</code> then
 *                  the text is set to the empty string ""
 * @see         java.awt.TextComponent#getText
 */
public synchronized void setText(String t) {
    boolean skipTextEvent = (text == null || text.isEmpty())
            && (t == null || t.isEmpty());
    text = (t != null) ? t : "";
    TextComponentPeer peer = (TextComponentPeer)this.peer;
    // Please note that we do not want to post an event
    // if TextArea.setText() or TextField.setText() replaces an empty text
    // by an empty text, that is, if component's text remains unchanged.
    if (peer != null && !skipTextEvent) {
        peer.setText(text);
    }
}
 
Example 12
Source File: TextComponent.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
 * 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</code> then
 *                  the text is set to the empty string ""
 * @see         java.awt.TextComponent#getText
 */
public synchronized void setText(String t) {
    boolean skipTextEvent = (text == null || text.isEmpty())
            && (t == null || t.isEmpty());
    text = (t != null) ? t : "";
    TextComponentPeer peer = (TextComponentPeer)this.peer;
    // Please note that we do not want to post an event
    // if TextArea.setText() or TextField.setText() replaces an empty text
    // by an empty text, that is, if component's text remains unchanged.
    if (peer != null && !skipTextEvent) {
        peer.setText(text);
    }
}
 
Example 13
Source File: TextComponent.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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</code> then
 *                  the text is set to the empty string ""
 * @see         java.awt.TextComponent#getText
 */
public synchronized void setText(String t) {
    boolean skipTextEvent = (text == null || text.isEmpty())
            && (t == null || t.isEmpty());
    text = (t != null) ? t : "";
    TextComponentPeer peer = (TextComponentPeer)this.peer;
    // Please note that we do not want to post an event
    // if TextArea.setText() or TextField.setText() replaces an empty text
    // by an empty text, that is, if component's text remains unchanged.
    if (peer != null && !skipTextEvent) {
        peer.setText(text);
    }
}
 
Example 14
Source File: TextComponent.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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</code> then
 *                  the text is set to the empty string ""
 * @see         java.awt.TextComponent#getText
 */
public synchronized void setText(String t) {
    boolean skipTextEvent = (text == null || text.isEmpty())
            && (t == null || t.isEmpty());
    text = (t != null) ? t : "";
    TextComponentPeer peer = (TextComponentPeer)this.peer;
    // Please note that we do not want to post an event
    // if TextArea.setText() or TextField.setText() replaces an empty text
    // by an empty text, that is, if component's text remains unchanged.
    if (peer != null && !skipTextEvent) {
        peer.setText(text);
    }
}
 
Example 15
Source File: TextComponent.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * 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</code> then
 *                  the text is set to the empty string ""
 * @see         java.awt.TextComponent#getText
 */
public synchronized void setText(String t) {
    boolean skipTextEvent = (text == null || text.isEmpty())
            && (t == null || t.isEmpty());
    text = (t != null) ? t : "";
    TextComponentPeer peer = (TextComponentPeer)this.peer;
    // Please note that we do not want to post an event
    // if TextArea.setText() or TextField.setText() replaces an empty text
    // by an empty text, that is, if component's text remains unchanged.
    if (peer != null && !skipTextEvent) {
        peer.setText(text);
    }
}
 
Example 16
Source File: TextComponent.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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</code> then
 *                  the text is set to the empty string ""
 * @see         java.awt.TextComponent#getText
 */
public synchronized void setText(String t) {
    boolean skipTextEvent = (text == null || text.isEmpty())
            && (t == null || t.isEmpty());
    text = (t != null) ? t : "";
    TextComponentPeer peer = (TextComponentPeer)this.peer;
    // Please note that we do not want to post an event
    // if TextArea.setText() or TextField.setText() replaces an empty text
    // by an empty text, that is, if component's text remains unchanged.
    if (peer != null && !skipTextEvent) {
        peer.setText(text);
    }
}
 
Example 17
Source File: TextComponent.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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</code> then
 *                  the text is set to the empty string ""
 * @see         java.awt.TextComponent#getText
 */
public synchronized void setText(String t) {
    boolean skipTextEvent = (text == null || text.isEmpty())
            && (t == null || t.isEmpty());
    text = (t != null) ? t : "";
    TextComponentPeer peer = (TextComponentPeer)this.peer;
    // Please note that we do not want to post an event
    // if TextArea.setText() or TextField.setText() replaces an empty text
    // by an empty text, that is, if component's text remains unchanged.
    if (peer != null && !skipTextEvent) {
        peer.setText(text);
    }
}
 
Example 18
Source File: TextComponent.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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</code> then
 *                  the text is set to the empty string ""
 * @see         java.awt.TextComponent#getText
 */
public synchronized void setText(String t) {
    boolean skipTextEvent = (text == null || text.isEmpty())
            && (t == null || t.isEmpty());
    text = (t != null) ? t : "";
    TextComponentPeer peer = (TextComponentPeer)this.peer;
    // Please note that we do not want to post an event
    // if TextArea.setText() or TextField.setText() replaces an empty text
    // by an empty text, that is, if component's text remains unchanged.
    if (peer != null && !skipTextEvent) {
        peer.setText(text);
    }
}