Java Code Examples for java.awt.peer.ChoicePeer#select()

The following examples show how to use java.awt.peer.ChoicePeer#select() . 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: Choice.java    From jdk8u-jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Sets the selected item in this <code>Choice</code> menu to be the
 * item at the specified position.
 *
 * <p>Note that this method should be primarily used to
 * initially select an item in this component.
 * Programmatically calling this method will <i>not</i> trigger
 * an <code>ItemEvent</code>.  The only way to trigger an
 * <code>ItemEvent</code> is by user interaction.
 *
 * @param      pos      the position of the selected item
 * @exception  IllegalArgumentException if the specified
 *                            position is greater than the
 *                            number of items or less than zero
 * @see        #getSelectedItem
 * @see        #getSelectedIndex
 */
public synchronized void select(int pos) {
    if ((pos >= pItems.size()) || (pos < 0)) {
        throw new IllegalArgumentException("illegal Choice item position: " + pos);
    }
    if (pItems.size() > 0) {
        selectedIndex = pos;
        ChoicePeer peer = (ChoicePeer)this.peer;
        if (peer != null) {
            peer.select(pos);
        }
    }
}
 
Example 2
Source File: Choice.java    From jdk8u-dev-jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Sets the selected item in this <code>Choice</code> menu to be the
 * item at the specified position.
 *
 * <p>Note that this method should be primarily used to
 * initially select an item in this component.
 * Programmatically calling this method will <i>not</i> trigger
 * an <code>ItemEvent</code>.  The only way to trigger an
 * <code>ItemEvent</code> is by user interaction.
 *
 * @param      pos      the position of the selected item
 * @exception  IllegalArgumentException if the specified
 *                            position is greater than the
 *                            number of items or less than zero
 * @see        #getSelectedItem
 * @see        #getSelectedIndex
 */
public synchronized void select(int pos) {
    if ((pos >= pItems.size()) || (pos < 0)) {
        throw new IllegalArgumentException("illegal Choice item position: " + pos);
    }
    if (pItems.size() > 0) {
        selectedIndex = pos;
        ChoicePeer peer = (ChoicePeer)this.peer;
        if (peer != null) {
            peer.select(pos);
        }
    }
}
 
Example 3
Source File: Choice.java    From jdk-1.7-annotated with Apache License 2.0 3 votes vote down vote up
/**
 * Sets the selected item in this <code>Choice</code> menu to be the
 * item at the specified position.
 *
 * <p>Note that this method should be primarily used to
 * initially select an item in this component.
 * Programmatically calling this method will <i>not</i> trigger
 * an <code>ItemEvent</code>.  The only way to trigger an
 * <code>ItemEvent</code> is by user interaction.
 *
 * @param      pos      the positon of the selected item
 * @exception  IllegalArgumentException if the specified
 *                            position is greater than the
 *                            number of items or less than zero
 * @see        #getSelectedItem
 * @see        #getSelectedIndex
 */
public synchronized void select(int pos) {
    if ((pos >= pItems.size()) || (pos < 0)) {
        throw new IllegalArgumentException("illegal Choice item position: " + pos);
    }
    if (pItems.size() > 0) {
        selectedIndex = pos;
        ChoicePeer peer = (ChoicePeer)this.peer;
        if (peer != null) {
            peer.select(pos);
        }
    }
}
 
Example 4
Source File: Choice.java    From jdk8u-jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Sets the selected item in this <code>Choice</code> menu to be the
 * item at the specified position.
 *
 * <p>Note that this method should be primarily used to
 * initially select an item in this component.
 * Programmatically calling this method will <i>not</i> trigger
 * an <code>ItemEvent</code>.  The only way to trigger an
 * <code>ItemEvent</code> is by user interaction.
 *
 * @param      pos      the position of the selected item
 * @exception  IllegalArgumentException if the specified
 *                            position is greater than the
 *                            number of items or less than zero
 * @see        #getSelectedItem
 * @see        #getSelectedIndex
 */
public synchronized void select(int pos) {
    if ((pos >= pItems.size()) || (pos < 0)) {
        throw new IllegalArgumentException("illegal Choice item position: " + pos);
    }
    if (pItems.size() > 0) {
        selectedIndex = pos;
        ChoicePeer peer = (ChoicePeer)this.peer;
        if (peer != null) {
            peer.select(pos);
        }
    }
}
 
Example 5
Source File: Choice.java    From jdk8u_jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Sets the selected item in this <code>Choice</code> menu to be the
 * item at the specified position.
 *
 * <p>Note that this method should be primarily used to
 * initially select an item in this component.
 * Programmatically calling this method will <i>not</i> trigger
 * an <code>ItemEvent</code>.  The only way to trigger an
 * <code>ItemEvent</code> is by user interaction.
 *
 * @param      pos      the position of the selected item
 * @exception  IllegalArgumentException if the specified
 *                            position is greater than the
 *                            number of items or less than zero
 * @see        #getSelectedItem
 * @see        #getSelectedIndex
 */
public synchronized void select(int pos) {
    if ((pos >= pItems.size()) || (pos < 0)) {
        throw new IllegalArgumentException("illegal Choice item position: " + pos);
    }
    if (pItems.size() > 0) {
        selectedIndex = pos;
        ChoicePeer peer = (ChoicePeer)this.peer;
        if (peer != null) {
            peer.select(pos);
        }
    }
}
 
Example 6
Source File: Choice.java    From openjdk-8 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Sets the selected item in this <code>Choice</code> menu to be the
 * item at the specified position.
 *
 * <p>Note that this method should be primarily used to
 * initially select an item in this component.
 * Programmatically calling this method will <i>not</i> trigger
 * an <code>ItemEvent</code>.  The only way to trigger an
 * <code>ItemEvent</code> is by user interaction.
 *
 * @param      pos      the position of the selected item
 * @exception  IllegalArgumentException if the specified
 *                            position is greater than the
 *                            number of items or less than zero
 * @see        #getSelectedItem
 * @see        #getSelectedIndex
 */
public synchronized void select(int pos) {
    if ((pos >= pItems.size()) || (pos < 0)) {
        throw new IllegalArgumentException("illegal Choice item position: " + pos);
    }
    if (pItems.size() > 0) {
        selectedIndex = pos;
        ChoicePeer peer = (ChoicePeer)this.peer;
        if (peer != null) {
            peer.select(pos);
        }
    }
}
 
Example 7
Source File: Choice.java    From openjdk-8-source with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Sets the selected item in this <code>Choice</code> menu to be the
 * item at the specified position.
 *
 * <p>Note that this method should be primarily used to
 * initially select an item in this component.
 * Programmatically calling this method will <i>not</i> trigger
 * an <code>ItemEvent</code>.  The only way to trigger an
 * <code>ItemEvent</code> is by user interaction.
 *
 * @param      pos      the position of the selected item
 * @exception  IllegalArgumentException if the specified
 *                            position is greater than the
 *                            number of items or less than zero
 * @see        #getSelectedItem
 * @see        #getSelectedIndex
 */
public synchronized void select(int pos) {
    if ((pos >= pItems.size()) || (pos < 0)) {
        throw new IllegalArgumentException("illegal Choice item position: " + pos);
    }
    if (pItems.size() > 0) {
        selectedIndex = pos;
        ChoicePeer peer = (ChoicePeer)this.peer;
        if (peer != null) {
            peer.select(pos);
        }
    }
}
 
Example 8
Source File: Choice.java    From hottub with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Sets the selected item in this <code>Choice</code> menu to be the
 * item at the specified position.
 *
 * <p>Note that this method should be primarily used to
 * initially select an item in this component.
 * Programmatically calling this method will <i>not</i> trigger
 * an <code>ItemEvent</code>.  The only way to trigger an
 * <code>ItemEvent</code> is by user interaction.
 *
 * @param      pos      the position of the selected item
 * @exception  IllegalArgumentException if the specified
 *                            position is greater than the
 *                            number of items or less than zero
 * @see        #getSelectedItem
 * @see        #getSelectedIndex
 */
public synchronized void select(int pos) {
    if ((pos >= pItems.size()) || (pos < 0)) {
        throw new IllegalArgumentException("illegal Choice item position: " + pos);
    }
    if (pItems.size() > 0) {
        selectedIndex = pos;
        ChoicePeer peer = (ChoicePeer)this.peer;
        if (peer != null) {
            peer.select(pos);
        }
    }
}
 
Example 9
Source File: Choice.java    From Java8CN with Apache License 2.0 3 votes vote down vote up
/**
 * Sets the selected item in this <code>Choice</code> menu to be the
 * item at the specified position.
 *
 * <p>Note that this method should be primarily used to
 * initially select an item in this component.
 * Programmatically calling this method will <i>not</i> trigger
 * an <code>ItemEvent</code>.  The only way to trigger an
 * <code>ItemEvent</code> is by user interaction.
 *
 * @param      pos      the position of the selected item
 * @exception  IllegalArgumentException if the specified
 *                            position is greater than the
 *                            number of items or less than zero
 * @see        #getSelectedItem
 * @see        #getSelectedIndex
 */
public synchronized void select(int pos) {
    if ((pos >= pItems.size()) || (pos < 0)) {
        throw new IllegalArgumentException("illegal Choice item position: " + pos);
    }
    if (pItems.size() > 0) {
        selectedIndex = pos;
        ChoicePeer peer = (ChoicePeer)this.peer;
        if (peer != null) {
            peer.select(pos);
        }
    }
}
 
Example 10
Source File: Choice.java    From jdk1.8-source-analysis with Apache License 2.0 3 votes vote down vote up
/**
 * Sets the selected item in this <code>Choice</code> menu to be the
 * item at the specified position.
 *
 * <p>Note that this method should be primarily used to
 * initially select an item in this component.
 * Programmatically calling this method will <i>not</i> trigger
 * an <code>ItemEvent</code>.  The only way to trigger an
 * <code>ItemEvent</code> is by user interaction.
 *
 * @param      pos      the position of the selected item
 * @exception  IllegalArgumentException if the specified
 *                            position is greater than the
 *                            number of items or less than zero
 * @see        #getSelectedItem
 * @see        #getSelectedIndex
 */
public synchronized void select(int pos) {
    if ((pos >= pItems.size()) || (pos < 0)) {
        throw new IllegalArgumentException("illegal Choice item position: " + pos);
    }
    if (pItems.size() > 0) {
        selectedIndex = pos;
        ChoicePeer peer = (ChoicePeer)this.peer;
        if (peer != null) {
            peer.select(pos);
        }
    }
}
 
Example 11
Source File: Choice.java    From openjdk-jdk9 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Sets the selected item in this {@code Choice} menu to be the
 * item at the specified position.
 *
 * <p>Note that this method should be primarily used to
 * initially select an item in this component.
 * Programmatically calling this method will <i>not</i> trigger
 * an {@code ItemEvent}.  The only way to trigger an
 * {@code ItemEvent} is by user interaction.
 *
 * @param      pos      the position of the selected item
 * @exception  IllegalArgumentException if the specified
 *                            position is greater than the
 *                            number of items or less than zero
 * @see        #getSelectedItem
 * @see        #getSelectedIndex
 */
public synchronized void select(int pos) {
    if ((pos >= pItems.size()) || (pos < 0)) {
        throw new IllegalArgumentException("illegal Choice item position: " + pos);
    }
    if (pItems.size() > 0) {
        selectedIndex = pos;
        ChoicePeer peer = (ChoicePeer)this.peer;
        if (peer != null) {
            peer.select(pos);
        }
    }
}
 
Example 12
Source File: Choice.java    From Bytecoder with Apache License 2.0 3 votes vote down vote up
/**
 * Sets the selected item in this {@code Choice} menu to be the
 * item at the specified position.
 *
 * <p>Note that this method should be primarily used to
 * initially select an item in this component.
 * Programmatically calling this method will <i>not</i> trigger
 * an {@code ItemEvent}.  The only way to trigger an
 * {@code ItemEvent} is by user interaction.
 *
 * @param      pos      the position of the selected item
 * @exception  IllegalArgumentException if the specified
 *                            position is greater than the
 *                            number of items or less than zero
 * @see        #getSelectedItem
 * @see        #getSelectedIndex
 */
public synchronized void select(int pos) {
    if ((pos >= pItems.size()) || (pos < 0)) {
        throw new IllegalArgumentException("illegal Choice item position: " + pos);
    }
    if (pItems.size() > 0) {
        selectedIndex = pos;
        ChoicePeer peer = (ChoicePeer)this.peer;
        if (peer != null) {
            peer.select(pos);
        }
    }
}
 
Example 13
Source File: Choice.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Sets the selected item in this <code>Choice</code> menu to be the
 * item at the specified position.
 *
 * <p>Note that this method should be primarily used to
 * initially select an item in this component.
 * Programmatically calling this method will <i>not</i> trigger
 * an <code>ItemEvent</code>.  The only way to trigger an
 * <code>ItemEvent</code> is by user interaction.
 *
 * @param      pos      the position of the selected item
 * @exception  IllegalArgumentException if the specified
 *                            position is greater than the
 *                            number of items or less than zero
 * @see        #getSelectedItem
 * @see        #getSelectedIndex
 */
public synchronized void select(int pos) {
    if ((pos >= pItems.size()) || (pos < 0)) {
        throw new IllegalArgumentException("illegal Choice item position: " + pos);
    }
    if (pItems.size() > 0) {
        selectedIndex = pos;
        ChoicePeer peer = (ChoicePeer)this.peer;
        if (peer != null) {
            peer.select(pos);
        }
    }
}
 
Example 14
Source File: Choice.java    From openjdk-jdk8u with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Sets the selected item in this <code>Choice</code> menu to be the
 * item at the specified position.
 *
 * <p>Note that this method should be primarily used to
 * initially select an item in this component.
 * Programmatically calling this method will <i>not</i> trigger
 * an <code>ItemEvent</code>.  The only way to trigger an
 * <code>ItemEvent</code> is by user interaction.
 *
 * @param      pos      the position of the selected item
 * @exception  IllegalArgumentException if the specified
 *                            position is greater than the
 *                            number of items or less than zero
 * @see        #getSelectedItem
 * @see        #getSelectedIndex
 */
public synchronized void select(int pos) {
    if ((pos >= pItems.size()) || (pos < 0)) {
        throw new IllegalArgumentException("illegal Choice item position: " + pos);
    }
    if (pItems.size() > 0) {
        selectedIndex = pos;
        ChoicePeer peer = (ChoicePeer)this.peer;
        if (peer != null) {
            peer.select(pos);
        }
    }
}
 
Example 15
Source File: Choice.java    From JDKSourceCode1.8 with MIT License 3 votes vote down vote up
/**
 * Sets the selected item in this <code>Choice</code> menu to be the
 * item at the specified position.
 *
 * <p>Note that this method should be primarily used to
 * initially select an item in this component.
 * Programmatically calling this method will <i>not</i> trigger
 * an <code>ItemEvent</code>.  The only way to trigger an
 * <code>ItemEvent</code> is by user interaction.
 *
 * @param      pos      the position of the selected item
 * @exception  IllegalArgumentException if the specified
 *                            position is greater than the
 *                            number of items or less than zero
 * @see        #getSelectedItem
 * @see        #getSelectedIndex
 */
public synchronized void select(int pos) {
    if ((pos >= pItems.size()) || (pos < 0)) {
        throw new IllegalArgumentException("illegal Choice item position: " + pos);
    }
    if (pItems.size() > 0) {
        selectedIndex = pos;
        ChoicePeer peer = (ChoicePeer)this.peer;
        if (peer != null) {
            peer.select(pos);
        }
    }
}
 
Example 16
Source File: Choice.java    From jdk8u60 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Sets the selected item in this <code>Choice</code> menu to be the
 * item at the specified position.
 *
 * <p>Note that this method should be primarily used to
 * initially select an item in this component.
 * Programmatically calling this method will <i>not</i> trigger
 * an <code>ItemEvent</code>.  The only way to trigger an
 * <code>ItemEvent</code> is by user interaction.
 *
 * @param      pos      the position of the selected item
 * @exception  IllegalArgumentException if the specified
 *                            position is greater than the
 *                            number of items or less than zero
 * @see        #getSelectedItem
 * @see        #getSelectedIndex
 */
public synchronized void select(int pos) {
    if ((pos >= pItems.size()) || (pos < 0)) {
        throw new IllegalArgumentException("illegal Choice item position: " + pos);
    }
    if (pItems.size() > 0) {
        selectedIndex = pos;
        ChoicePeer peer = (ChoicePeer)this.peer;
        if (peer != null) {
            peer.select(pos);
        }
    }
}
 
Example 17
Source File: Choice.java    From TencentKona-8 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Sets the selected item in this <code>Choice</code> menu to be the
 * item at the specified position.
 *
 * <p>Note that this method should be primarily used to
 * initially select an item in this component.
 * Programmatically calling this method will <i>not</i> trigger
 * an <code>ItemEvent</code>.  The only way to trigger an
 * <code>ItemEvent</code> is by user interaction.
 *
 * @param      pos      the position of the selected item
 * @exception  IllegalArgumentException if the specified
 *                            position is greater than the
 *                            number of items or less than zero
 * @see        #getSelectedItem
 * @see        #getSelectedIndex
 */
public synchronized void select(int pos) {
    if ((pos >= pItems.size()) || (pos < 0)) {
        throw new IllegalArgumentException("illegal Choice item position: " + pos);
    }
    if (pItems.size() > 0) {
        selectedIndex = pos;
        ChoicePeer peer = (ChoicePeer)this.peer;
        if (peer != null) {
            peer.select(pos);
        }
    }
}
 
Example 18
Source File: Choice.java    From dragonwell8_jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Sets the selected item in this <code>Choice</code> menu to be the
 * item at the specified position.
 *
 * <p>Note that this method should be primarily used to
 * initially select an item in this component.
 * Programmatically calling this method will <i>not</i> trigger
 * an <code>ItemEvent</code>.  The only way to trigger an
 * <code>ItemEvent</code> is by user interaction.
 *
 * @param      pos      the position of the selected item
 * @exception  IllegalArgumentException if the specified
 *                            position is greater than the
 *                            number of items or less than zero
 * @see        #getSelectedItem
 * @see        #getSelectedIndex
 */
public synchronized void select(int pos) {
    if ((pos >= pItems.size()) || (pos < 0)) {
        throw new IllegalArgumentException("illegal Choice item position: " + pos);
    }
    if (pItems.size() > 0) {
        selectedIndex = pos;
        ChoicePeer peer = (ChoicePeer)this.peer;
        if (peer != null) {
            peer.select(pos);
        }
    }
}