Rectangle (int tabIndex, Rectangle dest) { dest.width = rects[tabIndex].width; dest.height = rects[tabIndex].height; JViewport viewport = getScrollableTabViewport(); if (myShowHiddenTabsButton != null && viewport != null) { Point vpp = viewport.getLocation(); Point viewp = viewport.getViewPosition(); dest.x = rects[tabIndex].x + vpp.x - viewp.x; dest.y = rects[tabIndex].y + vpp.y - viewp.y; } else { dest.x = rects[tabIndex].x; dest.y = rects[tabIndex].y; } return dest; }