@Override public void mouseReleased(final MouseEvent e) { if (linkListener == null) return; if (SwingUtilities.isLeftMouseButton(e)) { editor.endSelection(); // evaluate link if (!editor.selected()) { final TextIterator iter = rend.jump(e.getPoint()); final String link = iter.link(); if (link != null) linkListener.linkClicked(link); } } }
@Override public Color getColor(final TextIterator iter) { final int ch = iter.curr(); final boolean quote = ch == '"'; Color color = quoted || quote ? KEYWORD : plain; if (!quoted) { if ("{}[]".indexOf(ch) != -1) color = STRING; if (":,".indexOf(ch) != -1) color = FUNCTION; } if (quote) quoted ^= true; return color; }
@Override public final void mouseMoved(final MouseEvent e) { if (linkListener == null) return; final TextIterator iter = rend.jump(e.getPoint()); gui.cursor(iter.link() != null ? CURSORHAND : CURSORARROW); }