private <E> void addComboBoxListener( final FComboBox<E> comboBox, final ForgePreferences.FPref setting) { comboBox.addItemListener( new ItemListener() { @Override public void itemStateChanged(final ItemEvent e) { final E selectedType = comboBox.getSelectedItem(); CSubmenuPreferences.this.prefs.setPref(setting, selectedType.toString()); CSubmenuPreferences.this.prefs.save(); } }); }
private void initializeCloseActionComboBox() { final FComboBoxPanel<CloseAction> panel = this.view.getCloseActionComboBoxPanel(); final FComboBox<CloseAction> comboBox = new FComboBox<>(CloseAction.values()); comboBox.addItemListener( new ItemListener() { @Override public void itemStateChanged(final ItemEvent e) { Singletons.getControl().setCloseAction(comboBox.getSelectedItem()); } }); panel.setComboBox(comboBox, Singletons.getControl().getCloseAction()); }