Beispiel #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;
 }
Beispiel #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;
 }
Beispiel #3
0
 /** Resizes the maximum and thumb of both scrollbars. */
 void resizeScrollBars() {
   Rectangle clientArea = canvas.getClientArea();
   ScrollBar bar = canvas.getHorizontalBar();
   if (bar != null) {
     bar.setMaximum(maxX);
     bar.setThumb(clientArea.width);
     bar.setPageIncrement(clientArea.width);
   }
   bar = canvas.getVerticalBar();
   if (bar != null) {
     bar.setMaximum(maxY);
     bar.setThumb(clientArea.height);
     bar.setPageIncrement(clientArea.height);
   }
 }