Example usage for java.awt.event ItemEvent SELECTED

List of usage examples for java.awt.event ItemEvent SELECTED

Introduction

In this page you can find the example usage for java.awt.event ItemEvent SELECTED.

Prototype

int SELECTED

To view the source code for java.awt.event ItemEvent SELECTED.

Click Source Link

Document

This state-change value indicates that an item was selected.

Usage

From source file:com.osparking.osparking.Settings_System.java

private void GateCountComboBoxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_GateCountComboBoxItemStateChanged
    if (evt.getStateChange() == ItemEvent.SELECTED) {
        String gateCountStr = (String) GateCountComboBox.getSelectedItem();

        if (Integer.parseInt(gateCountStr) == gateCount) {
            changedControls.remove(GateCountComboBox);
        } else {/*from w  ww.j  av  a2 s  .co m*/
            changedControls.add(GateCountComboBox);
        }
    }
}

From source file:com.osparking.osparking.Settings_System.java

private void ImageDurationCBoxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_ImageDurationCBoxItemStateChanged
    if (evt.getStateChange() == ItemEvent.SELECTED) {
        ConvComboBoxItem item = (ConvComboBoxItem) ImageDurationCBox.getSelectedItem();

        if ((Integer) (item.getKeyValue()) == maxMaintainDate) {
            changedControls.remove(ImageDurationCBox);
        } else {//ww w .ja v  a 2s .c o m
            changedControls.add(ImageDurationCBox);
        }
    }
}

From source file:com.osparking.osparking.Settings_System.java

private void PopSizeCBoxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_PopSizeCBoxItemStateChanged
    if (evt.getStateChange() == ItemEvent.SELECTED) {
        if (PopSizeCBox.getSelectedIndex() == statCountIndex) {
            changedControls.remove(PopSizeCBox);
        } else {/*  w  w  w  .jav  a  2 s  . c o  m*/
            changedControls.add(PopSizeCBox);
        }
    }
}

From source file:com.osparking.osparking.Settings_System.java

private void FlowingComboBoxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_FlowingComboBoxItemStateChanged
    if (evt.getStateChange() == ItemEvent.SELECTED) {
        String newFlowCycleStr = ((String) FlowingComboBox.getSelectedItem()).replace(",", "");

        if (Integer.parseInt(newFlowCycleStr) == EBD_flowCycle) {
            changedControls.remove(FlowingComboBox);
        } else {/*www .  j  av a  2s. co  m*/
            changedControls.add(FlowingComboBox);
        }
    }
}

From source file:com.osparking.osparking.Settings_System.java

private void BlinkingComboBoxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_BlinkingComboBoxItemStateChanged
    if (evt.getStateChange() == ItemEvent.SELECTED) {
        String newBlinkCycleStr = ((String) BlinkingComboBox.getSelectedItem()).replace(",", "");

        if (Integer.parseInt(newBlinkCycleStr) == EBD_blinkCycle) {
            changedControls.remove(BlinkingComboBox);
        } else {/*w  ww  . ja  v a 2 s . c o m*/
            changedControls.add(BlinkingComboBox);
        }
    }
}

From source file:com.osparking.osparking.Settings_System.java

private void prepareComPortControls() {
    E_Board1_comLabel = new javax.swing.JLabel();
    E_Board2_comLabel = new javax.swing.JLabel();
    E_Board3_comLabel = new javax.swing.JLabel();
    E_Board4_comLabel = new javax.swing.JLabel();
    GateBar1_comLabel = new javax.swing.JLabel();
    GateBar2_comLabel = new javax.swing.JLabel();
    GateBar3_comLabel = new javax.swing.JLabel();
    GateBar4_comLabel = new javax.swing.JLabel();

    E_Board1_comLabel.setName("E_Board1_comLabel"); // E_Board1_comLabel
    E_Board2_comLabel.setName("E_Board2_comLabel");
    E_Board3_comLabel.setName("E_Board3_comLabel");
    E_Board4_comLabel.setName("E_Board4_comLabel");
    GateBar1_comLabel.setName("GateBar1_comLabel");
    GateBar2_comLabel.setName("GateBar2_comLabel");
    GateBar3_comLabel.setName("GateBar3_comLabel");
    GateBar4_comLabel.setName("GateBar4_comLabel");

    augmentComponentMap(E_Board1_comLabel, componentMap);
    augmentComponentMap(E_Board2_comLabel, componentMap);
    augmentComponentMap(E_Board3_comLabel, componentMap);
    augmentComponentMap(E_Board4_comLabel, componentMap);
    augmentComponentMap(GateBar1_comLabel, componentMap);
    augmentComponentMap(GateBar2_comLabel, componentMap);
    augmentComponentMap(GateBar3_comLabel, componentMap);
    augmentComponentMap(GateBar4_comLabel, componentMap);

    initComPortIDLabel(E_Board1_comLabel);
    initComPortIDLabel(E_Board2_comLabel);
    initComPortIDLabel(E_Board3_comLabel);
    initComPortIDLabel(E_Board4_comLabel);
    initComPortIDLabel(GateBar1_comLabel);
    initComPortIDLabel(GateBar2_comLabel);
    initComPortIDLabel(GateBar3_comLabel);
    initComPortIDLabel(GateBar4_comLabel);

    E_Board1_comID_CBox = new JComboBox();
    E_Board2_comID_CBox = new JComboBox();
    E_Board3_comID_CBox = new JComboBox();
    E_Board4_comID_CBox = new JComboBox();
    GateBar1_comID_CBox = new JComboBox();
    GateBar2_comID_CBox = new JComboBox();
    GateBar3_comID_CBox = new JComboBox();
    GateBar4_comID_CBox = new JComboBox();

    E_Board1_comID_CBox.setName("E_Board1_comID_CBox");
    E_Board2_comID_CBox.setName("E_Board2_comID_CBox");
    E_Board3_comID_CBox.setName("E_Board3_comID_CBox");
    E_Board4_comID_CBox.setName("E_Board4_comID_CBox");
    GateBar1_comID_CBox.setName("GateBar1_comID_CBox");
    GateBar2_comID_CBox.setName("GateBar2_comID_CBox");
    GateBar3_comID_CBox.setName("GateBar3_comID_CBox");
    GateBar4_comID_CBox.setName("GateBar4_comID_CBox");

    augmentComponentMap(E_Board1_comID_CBox, componentMap);
    augmentComponentMap(E_Board2_comID_CBox, componentMap);
    augmentComponentMap(E_Board3_comID_CBox, componentMap);
    augmentComponentMap(E_Board4_comID_CBox, componentMap);
    augmentComponentMap(GateBar1_comID_CBox, componentMap);
    augmentComponentMap(GateBar2_comID_CBox, componentMap);
    augmentComponentMap(GateBar3_comID_CBox, componentMap);
    augmentComponentMap(GateBar4_comID_CBox, componentMap);

    //<editor-fold desc="-- Initialize other properties of COM ID combobox">
    for (int gate = 1; gate <= gateCount; gate++) {
        for (final DeviceType devType : DeviceType.values()) {
            String name = devType.name() + gate + "_comID_CBox";
            final JComboBox comIDcBox = ((JComboBox) getComponentByName(name));

            if (comIDcBox != null) {
                comIDcBox.setFont(new java.awt.Font(font_Type, font_Style, font_Size));
                comIDcBox.setModel(new javax.swing.DefaultComboBoxModel(
                        new String[] { "1", "2", "3", "4", "5", "6", "7", "8" }));
                comIDcBox.setMinimumSize(new java.awt.Dimension(50, CBOX_HEIGHT));
                comIDcBox.setPreferredSize(new java.awt.Dimension(50, CBOX_HEIGHT));
                final int gateNo = gate;

                comIDcBox.addItemListener(new java.awt.event.ItemListener() {
                    public void itemStateChanged(java.awt.event.ItemEvent evt) {
                        if (evt.getStateChange() == ItemEvent.SELECTED) {
                            String COM_ID = (String) comIDcBox.getSelectedItem();
                            if (COM_ID.equals(deviceComID[devType.ordinal()][gateNo])) {
                                changedControls.remove(comIDcBox);
                            } else {
                                changedControls.add(comIDcBox);
                            }//  w w  w  .  jav a 2 s .  c om
                        }
                    }
                });
            }
        }
    }
    //</editor-fold>
}