code: public void setScrollableArea (int x, int y, int width, int height)
      {
          Rectangle vb = _panel.getViewBounds();
          int hmax = x + width, vmax = y + height, value;
  
          if (width > vb.width) {
              value = MathUtil.bound(x, _hrange.getValue(), hmax - vb.width);
              _hrange.setRangeProperties(value, vb.width, x, hmax, false);
          } else {
              // Let's center it and lock it down.
              int newx = x - (vb.width - width)/2;
              _hrange.setRangeProperties(newx, 0, newx, newx, false);
          }
          if (height > vb.height) {
              value = MathUtil.bound(y, _vrange.getValue(), vmax - vb.height);
              _vrange.setRangeProperties(value, vb.height, y, vmax, false);
          } else {
              // Let's center it and lock it down.
              int newy = y - (vb.height - height)/2;
              _vrange.setRangeProperties(newy, 0, newy, newy, false);
          }
      }
docs: Informs the virtual range model the extent of the area over which
  we can scroll.