if (player.desktopScrollPane != null) { boolean needScroll = false; Dimension d = player.desktopScrollPane.getSize(); Point topLeft = player.desktopScrollPane.getScrollPosition(); Point botRight = new Point(topLeft.x + d.width, topLeft.y + d.height);  if (x < topLeft.x + SCROLL_MARGIN) {  topLeft.x = x - SCROLL_MARGIN; needScroll = true; } else if (x > botRight.x - SCROLL_MARGIN) {  topLeft.x = x - d.width + SCROLL_MARGIN; needScroll = true; } if (y < topLeft.y + SCROLL_MARGIN) {  topLeft.y = y - SCROLL_MARGIN; needScroll = true; } else if (y > botRight.y - SCROLL_MARGIN) {  topLeft.y = y - d.height + SCROLL_MARGIN; needScroll = true; } player.desktopScrollPane.setScrollPosition(topLeft.x, topLeft.y); }
  synchronized void softCursorMove(int x, int y) {    if (showSoftCursor) {      repaint(deferCursorUpdates,              cursorX - hotX, cursorY - hotY, cursorWidth, cursorHeight);      repaint(deferCursorUpdates,              x - hotX, y - hotY, cursorWidth, cursorHeight);    // Automatic viewport scrolling //      if (viewer.desktopScrollPane != null) {//	boolean needScroll = false;//	Dimension d = viewer.desktopScrollPane.getSize();//	Point topLeft = viewer.desktopScrollPane.getScrollPosition();//	Point botRight = new Point(topLeft.x + d.width, topLeft.y + d.height);////	if (x < topLeft.x + SCROLL_MARGIN) {//	  // shift left//	  topLeft.x = x - SCROLL_MARGIN;//	  needScroll = true;//	} else if (x > botRight.x - SCROLL_MARGIN) {//	  // shift right//	  topLeft.x = x - d.width + SCROLL_MARGIN;//	  needScroll = true;//	} //	if (y < topLeft.y + SCROLL_MARGIN) {//	  // shift up//	  topLeft.y = y - SCROLL_MARGIN;//	  needScroll = true;//	} else if (y > botRight.y - SCROLL_MARGIN) {//	  // shift down//	  topLeft.y = y - d.height + SCROLL_MARGIN;//	  needScroll = true;//	}//	viewer.desktopScrollPane.setScrollPosition(topLeft.x, topLeft.y);//      }    }    cursorX = x;    cursorY = y;  }