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