int max = scrollbar.getMaximum(); int min = scrollbar.getMinimum(); int value = scrollbar.getValue(); int extent = scrollbar.getVisibleAmount();   if (max == min) { thumbRect.x = trackRect.x; thumbRect.y = trackRect.y; if (scrollbar.getOrientation() == HORIZONTAL) { thumbRect.width = getMinimumThumbSize().width; thumbRect.height = trackRect.height; } else { thumbRect.width = trackRect.width; thumbRect.height = getMinimumThumbSize().height; } return thumbRect; }  if (scrollbar.getOrientation() == HORIZONTAL) { thumbRect.x = trackRect.x; thumbRect.x += (value - min) * trackRect.width / (max - min); thumbRect.y = trackRect.y;  thumbRect.width = Math.max(extent * trackRect.width / (max - min), getMinimumThumbSize().width); thumbRect.height = trackRect.height; } else { thumbRect.x = trackRect.x; thumbRect.y = trackRect.y + value * trackRect.height / (max - min);  thumbRect.width = trackRect.width; thumbRect.height = Math.max(extent * trackRect.height / (max - min), getMinimumThumbSize().height); }
  protected Rectangle getThumbBounds()  {    int max = scrollbar.getMaximum();    int min = scrollbar.getMinimum();    int value = scrollbar.getValue();    int extent = scrollbar.getVisibleAmount();    // System.err.println(this + ".getThumbBounds()");    if (max == min)      {	thumbRect.x = trackRect.x;	thumbRect.y = trackRect.y;	if (scrollbar.getOrientation() == HORIZONTAL)	  {	    thumbRect.width = getMinimumThumbSize().width;	    thumbRect.height = trackRect.height;	  }	else	  {	    thumbRect.width = trackRect.width;	    thumbRect.height = getMinimumThumbSize().height;	  }	return thumbRect;      }    if (scrollbar.getOrientation() == HORIZONTAL)      {	thumbRect.x = trackRect.x;	thumbRect.x += (value - min) * trackRect.width / (max - min);	thumbRect.y = trackRect.y;	thumbRect.width = Math.max(extent * trackRect.width / (max - min),                                   getMinimumThumbSize().width);	thumbRect.height = trackRect.height;      }    else      {	thumbRect.x = trackRect.x;	thumbRect.y = trackRect.y + value * trackRect.height / (max - min);	thumbRect.width = trackRect.width;	thumbRect.height = Math.max(extent * trackRect.height / (max - min),                                    getMinimumThumbSize().height);      }    return thumbRect;  }