Search in sources :

Example 81 with ItemListener

use of java.awt.event.ItemListener in project knime-core by knime.

the class SleepNodeDialog method waitToTimePanel.

private void waitToTimePanel() {
    m_waitToSpinnerModel = new SpinnerDateModel();
    m_toSpinner = new JSpinner(m_waitToSpinnerModel);
    m_toSpinner.setEditor(new JSpinner.DateEditor(m_toSpinner, "HH:mm:ss"));
    Calendar cal = Calendar.getInstance();
    cal.set(Calendar.HOUR_OF_DAY, 0);
    cal.set(Calendar.MINUTE, 0);
    cal.set(Calendar.SECOND, 0);
    cal.set(Calendar.MILLISECOND, 0);
    m_waitToSpinnerModel.setValue(cal.getTime());
    m_toRB = new JRadioButton("Wait to time:");
    m_toRB.doClick();
    m_toRB.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(final ItemEvent e) {
            if (m_toRB.isSelected()) {
                m_selection = 1;
            }
            m_toSpinner.setEnabled(m_toRB.isSelected());
        }
    });
}
Also used : ItemEvent(java.awt.event.ItemEvent) JRadioButton(javax.swing.JRadioButton) Calendar(java.util.Calendar) JSpinner(javax.swing.JSpinner) ItemListener(java.awt.event.ItemListener) SpinnerDateModel(javax.swing.SpinnerDateModel)

Example 82 with ItemListener

use of java.awt.event.ItemListener in project intellij-plugins by JetBrains.

the class ComboBoxWithMoreOption method initItems.

public void initItems() {
    addItems(this, myStartItems);
    this.addItem(myMoreItem);
    this.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.DESELECTED && myMoreItem.equals(getSelectedItem())) {
                final Object prevItem = e.getItem();
                ApplicationManager.getApplication().invokeLater(() -> {
                    if (getItemCount() != myStartItems.size() + myExtendedItems.size()) {
                        ComboBoxWithMoreOption.this.extend();
                        setSelectedItem(prevItem);
                    }
                    if (!ComboBoxWithMoreOption.this.isPopupVisible()) {
                        ComboBoxWithMoreOption.this.showPopup();
                    }
                });
            }
        }
    });
}
Also used : ItemEvent(java.awt.event.ItemEvent) ItemListener(java.awt.event.ItemListener)

Example 83 with ItemListener

use of java.awt.event.ItemListener in project gephi by gephi.

the class UIExporterPDFPanel method initEvents.

private void initEvents() {
    pageSizeCombo.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent e) {
            Object selectedItem = pageSizeCombo.getSelectedItem();
            if (selectedItem != customSizeString) {
                PageSizeItem pageSize = (PageSizeItem) selectedItem;
                setPageSize(pageSize);
            }
        }
    });
    widthTextField.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            updatePageSize();
        }
    });
    heightTextField.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            updatePageSize();
        }
    });
    unitLink.setAction(new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {
            millimeter = !millimeter;
            refreshUnit(true);
        }
    });
}
Also used : ItemEvent(java.awt.event.ItemEvent) ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) ItemListener(java.awt.event.ItemListener) AbstractAction(javax.swing.AbstractAction)

Example 84 with ItemListener

use of java.awt.event.ItemListener in project checkstyle by checkstyle.

the class Input0 method testMethod3.

//should give an ncss of 12
private void testMethod3() {
    int a = 0;
    switch(a) {
        //falls through
        case 1:
        case 2:
            System.identityHashCode("Hello");
            break;
        default:
            break;
    }
    ItemListener lis = new ItemListener() {

        //should give an ncss of 2
        public void itemStateChanged(ItemEvent e) {
            System.identityHashCode("Hello");
        }
    };
}
Also used : ItemEvent(java.awt.event.ItemEvent) ItemListener(java.awt.event.ItemListener)

Example 85 with ItemListener

use of java.awt.event.ItemListener in project gephi by gephi.

the class DynamicRangePanel method setup.

public void setup(final DynamicRangeFilter filter) {
    final BottomComponent bottomComponent = Lookup.getDefault().lookup(BottomComponent.class);
    timelineButton.setText(bottomComponent.isVisible() ? CLOSE : OPEN);
    timelineButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            if (!bottomComponent.isVisible()) {
                bottomComponent.setVisible(true);
                timelineButton.setText(CLOSE);
            } else {
                bottomComponent.setVisible(false);
                timelineButton.setText(OPEN);
            }
        }
    });
    keepEmptyCheckbox.setSelected(filter.isKeepNull());
    keepEmptyCheckbox.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent e) {
            if (!filter.isKeepNull() == keepEmptyCheckbox.isSelected()) {
                filter.getProperties()[1].setValue(keepEmptyCheckbox.isSelected());
            }
        }
    });
}
Also used : ItemEvent(java.awt.event.ItemEvent) ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) ItemListener(java.awt.event.ItemListener) BottomComponent(org.gephi.desktop.banner.perspective.spi.BottomComponent)

Aggregations

ItemListener (java.awt.event.ItemListener)162 ItemEvent (java.awt.event.ItemEvent)154 ActionEvent (java.awt.event.ActionEvent)45 ActionListener (java.awt.event.ActionListener)43 JCheckBox (javax.swing.JCheckBox)33 JPanel (javax.swing.JPanel)27 JLabel (javax.swing.JLabel)23 JComboBox (javax.swing.JComboBox)18 BoxLayout (javax.swing.BoxLayout)15 JTextField (javax.swing.JTextField)14 DocumentEvent (javax.swing.event.DocumentEvent)13 JButton (javax.swing.JButton)12 ChangeEvent (javax.swing.event.ChangeEvent)12 Dimension (java.awt.Dimension)11 ChangeListener (javax.swing.event.ChangeListener)11 GridBagConstraints (java.awt.GridBagConstraints)10 GridLayout (java.awt.GridLayout)10 Box (javax.swing.Box)10 GridBagLayout (java.awt.GridBagLayout)9 BorderLayout (java.awt.BorderLayout)8