public PrefOptionList(PrefMonitor<String> pref, StringGetter labelStr, PrefOption[] options) { this.pref = pref; this.labelStr = labelStr; label = new JLabel(labelStr.get() + " "); combo = new JComboBox(); for (PrefOption opt : options) { combo.addItem(opt); } combo.addActionListener(this); pref.addPropertyChangeListener(this); selectOption(pref.get()); }
public void propertyChange(PropertyChangeEvent event) { if (pref.isSource(event)) { selectOption(pref.get()); } }