pos.x = contentRect.x + contentRect.width - viewBounds.width;
pos.x = contentRect.x + contentRect.width - portBounds.width;
  public void scrollRectToVisible(Rectangle contentRect)  {    Component view = getView();    if (view == null)      return;              Point pos = getViewPosition();    Rectangle viewBounds = getView().getBounds();    Rectangle portBounds = getBounds();        if (isShowing())      getView().validate();        // If the bottom boundary of contentRect is below the port    // boundaries, scroll up as necessary.    if (contentRect.y + contentRect.height + viewBounds.y > portBounds.height)      pos.y = contentRect.y + contentRect.height - viewBounds.height;    // If contentRect.y is above the port boundaries, scroll down to    // contentRect.y.    if (contentRect.y + viewBounds.y < 0)      pos.y = contentRect.y;    // If the right boundary of contentRect is right from the port    // boundaries, scroll left as necessary.    if (contentRect.x + contentRect.width + viewBounds.x > portBounds.width)      pos.x = contentRect.x + contentRect.width - viewBounds.width;    // If contentRect.x is left from the port boundaries, scroll right to    // contentRect.x.    if (contentRect.x + viewBounds.x < 0)      pos.x = contentRect.x;    setViewPosition(pos);  }