Exemplo n.º 1
0
 @Override
 public void execute(final Object arg) {
   rend.updateScrollbar();
   // update scrollbar to display value within valid range
   scroll.pos(scroll.pos());
   rend.repaint();
 }
Exemplo n.º 2
0
 /**
  * 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();
 }
Exemplo n.º 3
0
 @Override
 public void execute(final Object algn) {
   // updates the visible area
   final int p = scroll.pos();
   final int y = rend.cursorY();
   final int m = y + rend.fontHeight() * 3 - getHeight();
   if (p < m || p > y) {
     final int align = (Integer) algn;
     scroll.pos(align == 0 ? y : align == 1 ? y - getHeight() / 2 : m);
   }
   rend.repaint();
 }
Exemplo n.º 4
0
 @Override
 public final void mouseWheelMoved(final MouseWheelEvent e) {
   scroll.pos(scroll.pos() + e.getUnitsToScroll() * 20);
   rend.repaint();
 }
Exemplo n.º 5
0
 /**
  * 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();
 }
Exemplo n.º 6
0
 /** Selects the whole text. */
 private void selectAll() {
   editor.selectAll();
   rend.repaint();
 }
Exemplo n.º 7
0
 /**
  * Sets the error marker.
  *
  * @param pos start of optional error mark
  */
 public final void error(final int pos) {
   editor.error(pos);
   rend.repaint();
 }
Exemplo n.º 8
0
 /** Removes the error marker. */
 public final void resetError() {
   editor.error(-1);
   rend.repaint();
 }