!7 sclass GeneralDefinitions extends DynModule { transient S term; transient JPanel stack; transient S listName = "General definitions (long list)"; JComponent visualize() { ret centerAndSouth(stack = dynamicVStack2(), withMargin(jcenteredbutton("Add definition...", r { fS t = term; inputText("Definition for: " + t, voidfunc(S def) { addToMechMap(listName, litmap(t, def)); infoBox("Definition added: " + t + " = " + def); update(); }); }))); } void update { fS s = trim(dm_getInterestingString()); term = s; removeAllComponents(stack); MultiMap map = mechMultiMapCI(listName); L answers = map.get(s); S text = ""; if (empty(answers)) text = "No definitions found for " + quote(s); else text = lines(map(answers, func(S a) -> S { s + " = " + a })); addComponent(stack, fontSize(12, jCenteredMultiLineLabel(text))); } }