📜  java jcombobox itemlistener 仅在值更改时 - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:13.948000             🧑  作者: Mango

代码示例1
comboBox.addItemListener(new ItemListener() {
    @Override
    public void itemStateChanged(ItemEvent e) {
      if(e.getStateChange() == ItemEvent.SELECTED) { // Check if the value got selected, ignore if it has been deselected
        //Do stuff
      }
    }
});