!7 sclass GeneralDefinitions extends DynModule { transient S term; transient JPanel stack; transient OptionalInputPanel inputPanel; transient S listName = "General definitions (long list)"; JComponent visualize() { inputPanel = new OptionalInputPanel(this); stack = dynamicVStack2(); ret northCenterAndSouth( inputPanel.panel, stack, withMargin(jcenteredbutton("Add definition...", r { fS t = term; final JTextField tfWord = jtextfield(t), tfDefinition = jtextfield(); showFormTitled("Add Definition", "Word/Phrase:", tfWord, "Definition:", tfDefinition, r { S word = gtt(tfWord), def = gtt(tfDefinition); if (nempty(word) && nempty(def)) { addToMechMap(listName, litmap(word, def)); infoBox("Definition added: " + word + " = " + def); updateMe(); } }); requestFocus(tfDefinition); }))); } void update { if (stack == null) ret; S s = inputPanel.input(); term = s; S text = makeText(s); replaceAllComponents(stack, ll(fontSize(17, jCenteredMultiLineLabel(text)))); } S makeText(fS s) { S text = ""; if (empty(s)) ret text; MultiMap map = mechMultiMapCI(listName); L answers = map.get(s); MultiMap map2 = mechMultiMapCI("Unauthorized Appends | " + listName); L answers2 = map2.get(s); if (empty(answers) && empty(answers2)) ret "No definitions found for " + quote(s); ret lines(concatLists( map(answers, func(S a) -> S { s + " = " + a }), map(answers2, func(S a) -> S { s + " " + unicode_questionedEquals() + " " + a }) )); } }