Rectangle (Rectangle baseBounds, boolean thumb) { boolean vertical = isVertical(); int borderSize = 2; int baseSize = vertical ? baseBounds.width : baseBounds.height; int maxSize = baseSize - (thumb ? borderSize * 2 : 0); int minSize = Math.min(baseSize / 2, JBUIScale.scale(7)) + (thumb ? 0 : borderSize * 2); int currentSize = minSize + (int)(myMouseOverScrollbarExpandLevel * (maxSize - minSize)); int currentBolderSize = thumb ? borderSize : 0; int x = baseBounds.x; int y = baseBounds.y; int width; int height; if (vertical) { x += baseBounds.width - currentSize - currentBolderSize; y += currentBolderSize; width = currentSize; height = baseBounds.height - currentBolderSize * 2; } else { x += currentBolderSize; y += baseBounds.height - currentSize - currentBolderSize; width = baseBounds.width - currentBolderSize * 2; height = currentSize; } width = Math.max(width, currentSize); height = Math.max(height, currentSize); return new Rectangle(x, y, width, height); }