protected Rectangle getIconsRect() {
		Rectangle r = super.getVisibleEditorRect();
		if( r == null )
			return null;

		boolean ltr = isLeftToRight();

		// remove width of leading/trailing components
		JComponent[] leftComponents = ltr ? getLeadingComponents() : getTrailingComponents();
		JComponent[] rightComponents = ltr ? getTrailingComponents() : getLeadingComponents();
		boolean leftVisible = false;
		boolean rightVisible = false;
		for( JComponent leftComponent : leftComponents ) {
			if( leftComponent != null && leftComponent.isVisible() ) {
				int w = leftComponent.getPreferredSize().width;
				r.x += w;
				r.width -= w;
				leftVisible = true;
			}
		}
		for( JComponent rightComponent : rightComponents ) {
			if( rightComponent != null && rightComponent.isVisible() ) {
				r.width -= rightComponent.getPreferredSize().width;
				rightVisible = true;
			}
		}

		// if a leading/trailing icons (or components) are shown, then the left/right margins are reduced
		// to the top margin, which places the icon nicely centered on left/right side
		if( leftVisible || (ltr ? hasLeadingIcon() : hasTrailingIcon()) ) {
			// reduce left margin
			Insets margin = getComponent().getMargin();
			int newLeftMargin = Math.min( margin.left, margin.top );
			if( newLeftMargin < margin.left ) {
				int diff = scale( margin.left - newLeftMargin );
				r.x -= diff;
				r.width += diff;
			}
		}
		if( rightVisible || (ltr ? hasTrailingIcon() : hasLeadingIcon()) ) {
			// reduce right margin
			Insets margin = getComponent().getMargin();
			int newRightMargin = Math.min( margin.right, margin.top );
			if( newRightMargin < margin.left )
				r.width += scale( margin.right - newRightMargin );
		}

		// make sure that width and height are not negative
		r.width = Math.max( r.width, 0 );
		r.height = Math.max( r.height, 0 );

		return r;
	}
Returns the rectangle used to paint leading and trailing icons.
It invokes {@code super.getVisibleEditorRect()} and reduces left and/or
right margin if the text field has leading or trailing icons or components.
Also, the preferred widths of leading and trailing components are removed.

@since 2
flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTextFieldUI.java