void (JComboBox comboBox) { comboBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(final ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { doApply(); } } }); }