Esempio n. 1
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;
 }
Esempio n. 2
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;
 }
 private static Integer getBarSelection(final ScrollBar scrollBar) {
   Integer result;
   if (scrollBar != null) {
     result = new Integer(scrollBar.getSelection());
   } else {
     result = null;
   }
   return result;
 }