Rectangle (TableCell key) { Rectangle columnVisibleRect = myComponent.getVisibleRect(); Rectangle cellRect = getCellRect(key); int visibleRight = Math.min(columnVisibleRect.x + columnVisibleRect.width, cellRect.x + cellRect.width); columnVisibleRect.x = Math.min(columnVisibleRect.x, cellRect.x); columnVisibleRect.width = Math.max(0, visibleRight - columnVisibleRect.x); return columnVisibleRect; }