Package java.awt.event

Examples of java.awt.event.ItemEvent


    }

    public final void testItemStateChanged() {
        ac.addPropertyChangeListener(propListener);
        assertNull(lastPropEvent);
        ((ItemListener) ac).itemStateChanged(new ItemEvent(checkbox, ItemEvent.ITEM_STATE_CHANGED,
                                                           checkbox, ItemEvent.DESELECTED));
        assertNotNull(lastPropEvent);
        assertSame(AccessibleContext.ACCESSIBLE_STATE_PROPERTY,
                   lastPropEvent.getPropertyName());
    }
View Full Code Here


        choice.addItemListener(new ItemListener() {
            public void itemStateChanged(ItemEvent ie) {
                eventProcessed = true;
            }
        });
        choice.processEvent(new ItemEvent(choice, ItemEvent.ITEM_STATE_CHANGED,
                                          null, ItemEvent.DESELECTED));
        assertTrue(eventProcessed);
    }
View Full Code Here

        checkbox.addItemListener(new ItemListener() {
            public void itemStateChanged(ItemEvent ie) {
                eventProcessed = true;
            }
        });
        checkbox.processEvent(new ItemEvent(checkbox,
                                              ItemEvent.ITEM_STATE_CHANGED,
                                              checkbox, ItemEvent.SELECTED));
        assertTrue(eventProcessed);
    }
View Full Code Here

    }

    protected void fireItemStateChanged(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

        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 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

        assertEquals("elem1", editor.getCellEditorValue());
        listener.reset();
        cb.fireActionEvent();
        assertTrue(listener.isOccured(TestCellEditorListener.STOPPPED));
        listener.reset();
        cb.fireItemStateChanged(new ItemEvent(cb, 0, "elem2", 0));
        assertFalse(listener.isOccured());
    }
View Full Code Here

    }

    public final void testItemStateChanged() {
        ac.addPropertyChangeListener(propListener);
        assertNull(lastPropEvent);
        ((ItemListener) ac).itemStateChanged(new ItemEvent(checkbox, ItemEvent.ITEM_STATE_CHANGED,
                                                           checkbox, ItemEvent.DESELECTED));
        assertNotNull(lastPropEvent);
        assertSame(AccessibleContext.ACCESSIBLE_STATE_PROPERTY,
                   lastPropEvent.getPropertyName());
    }
View Full Code Here

        choice.addItemListener(new ItemListener() {
            public void itemStateChanged(ItemEvent ie) {
                eventProcessed = true;
            }
        });
        choice.processEvent(new ItemEvent(choice, ItemEvent.ITEM_STATE_CHANGED,
                                          null, ItemEvent.DESELECTED));
        assertTrue(eventProcessed);
    }
View Full Code Here

    }

    public void testFireItemStateChanged() {
        Object item1 = "item1";
        Object item2 = "item2";
        ItemEvent event1 = new ItemEvent(buttonModel, 11, item1, 2);
        ItemEvent event2 = new ItemEvent(buttonModel, 111, item2, 1);
        ConcreteItemListener listener1 = new ConcreteItemListener();
        ConcreteItemListener listener2 = new ConcreteItemListener();
        buttonModel.addItemListener(listener1);
        buttonModel.addItemListener(listener2);
        buttonModel.fireItemStateChanged(event1);
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.