Package java.awt.event

Examples of java.awt.event.ItemEvent


    private void searchFor(String search) {
        for (int i = 0; i < m_mechsCurrent.length; i++) {
            if (m_mechsCurrent[i].getName().toLowerCase().startsWith(search)) {
                m_mechList.select(i);
                ItemEvent event = new ItemEvent(m_mechList,
                        ItemEvent.ITEM_STATE_CHANGED, m_mechList,
                        ItemEvent.SELECTED);
                itemStateChanged(event);
                break;
            }
View Full Code Here


        }
    }

    protected void selectedItemChanged() {
        if (selectedItemReminder != null) {
            ItemEvent itemEvent = new ItemEvent(JComboBox.this, ItemEvent.ITEM_STATE_CHANGED, selectedItemReminder, ItemEvent.DESELECTED);
            fireItemStateChanged(itemEvent);
        }
        Object newSelection = dataModel.getSelectedItem();
        if (isEditable || getIndex(newSelection) != -1) {
            ItemEvent itemEvent = new ItemEvent(JComboBox.this, ItemEvent.ITEM_STATE_CHANGED, newSelection, ItemEvent.SELECTED);
            fireItemStateChanged(itemEvent);
        }
    }
View Full Code Here

    public void setSelected(final boolean selected) {
        if (isSelected() != selected) {
            toggleState(SELECTED);
            int state = selected ? ItemEvent.SELECTED : ItemEvent.DESELECTED;
            ItemEvent event = new ItemEvent(this, ItemEvent.ITEM_STATE_CHANGED,
                                            this, state);
            fireItemStateChanged(event);
        }
    }
View Full Code Here

    }

    @Override
    AWTEvent createEvent(long when, int modifiers) {
        int state = checked ? ItemEvent.SELECTED : ItemEvent.DESELECTED;
        return new ItemEvent(this, ItemEvent.ITEM_STATE_CHANGED, getLabel(), state);
    }
View Full Code Here

    }

    private void generateEvent() {
        setState(!getState());
        int stateChange = (checked ? ItemEvent.SELECTED : ItemEvent.DESELECTED);
        postEvent(new ItemEvent(this, ItemEvent.ITEM_STATE_CHANGED, this, stateChange));
    }
View Full Code Here

    }

    protected void fireItemStateChanged(final ItemEvent event) {
        ItemListener[] listeners = getItemListeners();
        if (listeners.length > 0) {
            ItemEvent itemEvent = new ItemEvent(this, ItemEvent.ITEM_STATE_CHANGED, this, event.getStateChange());
            for (int i = 0; i < listeners.length; i++ ){
                listeners[i].itemStateChanged(itemEvent);
            }
        }
    }
View Full Code Here

            postEvent(new ActionEvent(List.this, ActionEvent.ACTION_PERFORMED,
                    getItem(currentIndex), when, mod));
        }

        public void fireItemEvent(int sel) {
            postEvent(new ItemEvent(List.this, ItemEvent.ITEM_STATE_CHANGED,
                    getItem(currentIndex), sel));
        }
View Full Code Here

        int itemHeight = fm.getHeight() + 2;
        return itemHeight;
    }

    void fireItemEvent() {
        postEvent(new ItemEvent(this, ItemEvent.ITEM_STATE_CHANGED, getSelectedItem(),
                ItemEvent.SELECTED));
    }
View Full Code Here

  protected void fireDataFileChange(PendingDataChange item) {
    // Guaranteed to return a non-null array
    Object[] listeners = ell.getListenerList();
    // Process the listeners last to first, notifying
    // those that are interested in this event
    ItemEvent fooEvent = new ItemEvent(this, 0, item, 0);
    for (int i = listeners.length-2; i>=0; i-=2) {
      if (listeners[i]==ItemListener.class) {
        ((ItemListener)listeners[i+1]).itemStateChanged(fooEvent);
      }
    }
View Full Code Here

  protected void fireDataFileChange(PendingDataChange item) {
    // Guaranteed to return a non-null array
    Object[] listeners = ell.getListenerList();
    // Process the listeners last to first, notifying
    // those that are interested in this event
    ItemEvent fooEvent = new ItemEvent(this, 0, item, 0);
    for (int i = listeners.length-2; i>=0; i-=2) {
      if (listeners[i]==ItemListener.class) {
        ((ItemListener)listeners[i+1]).itemStateChanged(fooEvent);
      }
    }
View Full Code Here

TOP

Related Classes of java.awt.event.ItemEvent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.