private void paintCellBackground( Graphics g, Component rendererComponent, Rectangle bounds,
		int row, boolean paintSelection )
	{
		int xOffset = 0;
		int imageOffset = 0;

		if( rendererComponent instanceof JLabel ) {
			JLabel label = (JLabel) rendererComponent;
			Icon icon = label.isEnabled() ? label.getIcon() : label.getDisabledIcon();
			imageOffset = (icon != null && label.getText() != null)
				? icon.getIconWidth() + Math.max( label.getIconTextGap() - 1, 0 )
				: 0;
			xOffset = label.getComponentOrientation().isLeftToRight() ? imageOffset : 0;
		}

		if( paintSelection ) {
			float arcTopLeft, arcTopRight, arcBottomLeft, arcBottomRight;
			arcTopLeft = arcTopRight = arcBottomLeft = arcBottomRight = UIScale.scale( selectionArc / 2f );

			if( useUnitedRoundedSelection() ) {
				if( row > 0 && tree.isRowSelected( row - 1 ) ) {
					Rectangle r = getPathBounds( tree, tree.getPathForRow( row - 1 ) );
					arcTopLeft = Math.min( arcTopLeft, r.x - bounds.x );
					arcTopRight = Math.min( arcTopRight, (bounds.x + bounds.width) - (r.x + r.width) );
				}
				if( row < tree.getRowCount() - 1 && tree.isRowSelected( row + 1 ) ) {
					Rectangle r = getPathBounds( tree, tree.getPathForRow( row + 1 ) );
					arcBottomLeft = Math.min( arcBottomLeft, r.x - bounds.x );
					arcBottomRight = Math.min( arcBottomRight, (bounds.x + bounds.width) - (r.x + r.width) );
				}
			}

			FlatUIUtils.paintSelection( (Graphics2D) g, bounds.x + xOffset, bounds.y, bounds.width - imageOffset, bounds.height,
				UIScale.scale( selectionInsets ), arcTopLeft, arcTopRight, arcBottomLeft, arcBottomRight, 0 );
		} else
			g.fillRect( bounds.x + xOffset, bounds.y, bounds.width - imageOffset, bounds.height );
	}
Similar to super.paintRow(), but supports wide selection and uses
inactive selection background/foreground if tree is not focused.
flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTreeUI.java