Exemple #1
0
 /**
  * Scrolls the canvas vertically.
  *
  * @param scrollBar
  */
 void scrollVertical(ScrollBar scrollBar) {
   Rectangle bounds = canvas.getClientArea();
   int y = -scrollBar.getSelection();
   if (y + maxY < bounds.height) {
     y = bounds.height - maxY;
   }
   canvas.scroll(cx, y, cx, cy, maxX, maxY, false);
   cy = y;
 }
Exemple #2
0
 /**
  * Scrolls the canvas horizontally.
  *
  * @param scrollBar
  */
 void scrollHorizontal(ScrollBar scrollBar) {
   Rectangle bounds = canvas.getClientArea();
   int x = -scrollBar.getSelection();
   if (x + maxX < bounds.width) {
     x = bounds.width - maxX;
   }
   canvas.scroll(x, cy, cx, cy, maxX, maxY, false);
   cx = x;
 }