Java Code Examples for java.awt.event.ItemListener#itemStateChanged()

The following examples show how to use java.awt.event.ItemListener#itemStateChanged() . 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: RepositorySelectorBuilder.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void fireSelectionChanged() {
    if ((selectionListeners == null) || selectionListeners.isEmpty()) {
        return;
    }

    final ItemEvent event = new ItemEvent(this,
                                          ItemEvent.ITEM_STATE_CHANGED,
                                          getSelectedRepository(),
                                          ItemEvent.SELECTED);
    for (ItemListener l : selectionListeners) {
        l.itemStateChanged(event);
    }
}
 
Example 2
Source File: CustomCheckBoxList.java    From tmc-intellij with MIT License 4 votes vote down vote up
protected void fireItemEvent(ItemEvent event) {
    for (ItemListener listener : itemListeners) {
        listener.itemStateChanged(event);
    }
}
 
Example 3
Source File: CheckboxMenuItem.java    From Bytecoder with Apache License 2.0 3 votes vote down vote up
/**
 * Processes item events occurring on this check box menu item by
 * dispatching them to any registered {@code ItemListener} objects.
 * <p>
 * This method is not called unless item events are
 * enabled for this menu item. Item events are enabled
 * when one of the following occurs:
 * <ul>
 * <li>An {@code ItemListener} object is registered
 * via {@code addItemListener}.
 * <li>Item events are enabled via {@code enableEvents}.
 * </ul>
 * <p>Note that if the event parameter is {@code null}
 * the behavior is unspecified and may result in an
 * exception.
 *
 * @param       e the item event
 * @see         java.awt.event.ItemEvent
 * @see         java.awt.event.ItemListener
 * @see         #addItemListener
 * @see         java.awt.MenuItem#enableEvents
 * @since       1.1
 */
protected void processItemEvent(ItemEvent e) {
    ItemListener listener = itemListener;
    if (listener != null) {
        listener.itemStateChanged(e);
    }
}
 
Example 4
Source File: CheckboxMenuItem.java    From openjdk-jdk9 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Processes item events occurring on this check box menu item by
 * dispatching them to any registered {@code ItemListener} objects.
 * <p>
 * This method is not called unless item events are
 * enabled for this menu item. Item events are enabled
 * when one of the following occurs:
 * <ul>
 * <li>An {@code ItemListener} object is registered
 * via {@code addItemListener}.
 * <li>Item events are enabled via {@code enableEvents}.
 * </ul>
 * <p>Note that if the event parameter is {@code null}
 * the behavior is unspecified and may result in an
 * exception.
 *
 * @param       e the item event
 * @see         java.awt.event.ItemEvent
 * @see         java.awt.event.ItemListener
 * @see         #addItemListener
 * @see         java.awt.MenuItem#enableEvents
 * @since       1.1
 */
protected void processItemEvent(ItemEvent e) {
    ItemListener listener = itemListener;
    if (listener != null) {
        listener.itemStateChanged(e);
    }
}