if (scrollbarDisplayPolicy == SCROLLBARS_NEVER) return viewsize;      boolean mayNeedVertical = false; boolean mayNeedHorizontal = false;  boolean needVertical = false; boolean needHorizontal = false;     if (dim.height > viewsize.height) needVertical = true; else if (dim.height > (viewsize.height - hScrollbarHeight))     mayNeedVertical = true;  if (dim.width > viewsize.width) needHorizontal = true; else if (dim.width > (viewsize.width - vScrollbarWidth)) mayNeedHorizontal = true;  if (needVertical && mayNeedHorizontal) needHorizontal = true;  if (needHorizontal && mayNeedVertical) needVertical = true;  if (needHorizontal) viewsize.height -= hScrollbarHeight;  if (needVertical) viewsize.width -= vScrollbarWidth;  return viewsize; }
	public Dimension getViewportSize() {		Dimension viewsize = getSize();		Insets insets = getInsets();		viewsize.width = viewsize.width - (insets.left + insets.right);		viewsize.height = viewsize.height - (insets.top + insets.bottom);		ScrollPaneAdjustable v = (ScrollPaneAdjustable) getVAdjustable();		ScrollPaneAdjustable h = (ScrollPaneAdjustable) getHAdjustable();		if ((v != null) && v.isVisible())			viewsize.width = viewsize.width - v.getSize().width;		if ((h != null) && h.isVisible())			viewsize.height = viewsize.height - v.getSize().height;		return (viewsize);	}