!7 sclass Categories > DynModule { InputChooser inputChooser = new(this); transient SingleComponentPanel form; start { dm_useLocalMechListCopies(); } visualize { ret northAndCenter(wrap(inputChooser), jfullcenter(form = singleComponentPanel())); } void update { if (form == null || !inputChooser.update()) ret; S input = inputChooser.input(); L words = words(input); final Map> wordCategories = ai_englishWordCategoriesWithElements(); for (S cat : keys(wordCategories)) print(cat + ": " + l(wordCategories.get(cat))); form.setComponentAndRevalidateParent(makeForm(pairsToParams(map(words, func(fS word) -> Pair { new L cats; for (S cat : keys(wordCategories)) if (contains(wordCategories.get(cat), word)) cats.add(cat); final JComboBox cb = jcombobox_withEmpty(keys(wordCategories)); ret pair( // quoted word setFontSize(18, jRightAlignedLabel(quote(word))), centerAndEast( // known categories jlabel(or2(joinWithComma(cats), "-")), jline( // combo box for add/remove category cb, jbutton("Add", rThread { addToMechList(first(ai_mechListNamesForAngleBracketCategory(selectedItem(cb))), word) }), // TODO jbutton("Remove", rThread { removeFromMechList(first(ai_mechListNamesForAngleBracketCategory(selectedItem(cb))), word)}) ))); })))); } }