Package java.awt.event

Examples of java.awt.event.ItemEvent


        ItemController l = new ItemController();
        comboBox.addItemListener(l);
        assertEquals(1, comboBox.getItemListeners().length);
        comboBox.addItemListener(new ItemController());
        assertEquals(2, comboBox.getItemListeners().length);
        comboBox.fireItemStateChanged(new ItemEvent(comboBox, ItemEvent.ITEM_STATE_CHANGED,
                "a", ItemEvent.SELECTED));
        assertEquals(1, l.getEvents().size());
        assertEquals(comboBox, l.getEvents().get(0).getSource());
        comboBox.removeItemListener(l);
        assertEquals(1, comboBox.getItemListeners().length);
View Full Code Here


    }

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

        if (getEventMode() == EM_AWT) {
            final Checkbox box = (Checkbox)comp;
            invokeAction(new Runnable() {
                public void run() {
                    box.setState(!box.getState());
                    ItemEvent e =
                        new ItemEvent(box, ItemEvent.ITEM_STATE_CHANGED,
                                      box, box.getState() ? 1 : 0);
                    postEvent(box, e);
                }
            });
        }
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

    private void initPresetChooser() {
        presetChooser.addItemListener(new ItemListener() {

            public void itemStateChanged(ItemEvent e) {
                final ItemEvent fe = e;
                if (!e.getItem().toString().equals("")) {
                    java.awt.EventQueue.invokeLater(new Runnable() {

                        public void run() {
                            serverInput.setText(fe.getItem().toString().split(":")[0]);
                            portInput.setText(fe.getItem().toString().split(":")[1]);
                        }
                    });
                }
            }
        });
View Full Code Here

                // Send ChangeEvent
                fireStateChanged();

                // Send ItemEvent
                int indeterminate = 3;
                fireItemStateChanged(new ItemEvent(
                        this, ItemEvent.ITEM_STATE_CHANGED, this,
                        indeterminate));
            }
        }
View Full Code Here

            // Send ChangeEvent
            fireStateChanged();

            // Send ItemEvent
            fireItemStateChanged(new ItemEvent(this,
                    ItemEvent.ITEM_STATE_CHANGED,
                    this,
                    this.isSelected() ? ItemEvent.SELECTED : ItemEvent.DESELECTED));

        }
View Full Code Here

            // Send ChangeEvent
            fireStateChanged();

            // Send ItemEvent
            fireItemStateChanged(new ItemEvent(this,
                    ItemEvent.ITEM_STATE_CHANGED,
                    this,
                    this.isSelected() ? ItemEvent.SELECTED : ItemEvent.DESELECTED));

        }
View Full Code Here

        }
        else {
            stateMask &= ~BUTTON_SELECTED;
        }

        fireItemStateChanged(new ItemEvent(this,
                ItemEvent.ITEM_STATE_CHANGED,
                this,
                b ? ItemEvent.SELECTED : ItemEvent.DESELECTED));

        fireStateChanged();
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.