!752 !include #1004828 // Java Analysis p { loadConceptsFrom("#1004820"); JavaTok j = conceptOfType(JavaTok.class); L tokens = sortedByField(findBackRefs(j, Token.class), "index"); new StringBuilder buf; int i = 0; for (Token t : tokens) { buf.append(htmlencode(substring(j.text, i, t.charIndex))); S col = odd(t.index/2) //? "#b8d1f3" : "#dae5f4"; ? "#CC0000" : "#0000CC"; // Coder Colors! buf.append(span(b(href(str(t.index), htmlencode(t.token()))), "style", "color: " + col)); i = t.charIndex + l(t.token()); } buf.append(htmlencode(substring(j.text, i))); S html = hhtml(pre(buf)); JEditorPane editorPane = new JEditorPane("text/html", html); editorPane.setEditable(false); editorPane.addHyperlinkListener(new HyperlinkListener { public void hyperlinkUpdate(HyperlinkEvent e) { print("Event! " + e.getEventType() + " " + e.getDescription() + " " + e.getURL()); } }); showFrame(new JScrollPane(editorPane)); }