static JComboBox dm_moduleSelectorComboBox(SimpleLiveValue lvModuleIDAndName) { final JComboBox cb = jLiveValueComboBox(emptyStringPlus(dm_listModuleIDsAndNames()), lvModuleIDAndName); final new Var listener; bindToComponent(cb, r { listener.set(vmBus_onModulesListChange(r { awt { S selected = squareBracketStuff(selectedItem(cb)); LS l = emptyStringPlus(dm_listModuleIDsAndNames()); // TODO: change items while keeping popup open if (!cb.isPopupVisible() || !moduleSelector_sameList(getComboBoxItems(cb), l)) setComboBoxItems(cb, l); setSelectedIndex(cb, indexOfStringWithSquareBracketStuffEq(l, selected)); } })); }, r { close(listener!) }); ret cb; }