/** * Jumps to the current, next or previous search string. * * @param dir search direction * @param select select hit */ protected final void jump(final SearchDir dir, final boolean select) { // updates the visible area final int y = rend.jump(dir, select); final int h = getHeight(); final int p = scroll.pos(); final int m = y + rend.fontHeight() * 3 - h; if (y != -1 && (p < m || p > y)) scroll.pos(y - h / 2); rend.repaint(); }
@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); } } }
/** * Selects the text at the specified position. * * @param point mouse position * @param start states if selection has just been started */ private void select(final Point point, final boolean start) { editor.select(rend.jump(point).pos(), start); rend.repaint(); }
@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); }