Пример #1
0
  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());
  }
Пример #2
0
 public void propertyChange(PropertyChangeEvent event) {
   if (pref.isSource(event)) {
     selectOption(pref.get());
   }
 }