int (@NotNull SimpleColoredComponent component, @Nullable Icon icon) { Insets iPad = component.getIpad(); int width = iPad.left + iPad.right; Border myBorder = component.getMyBorder(); if (myBorder != null) { Insets insets = myBorder.getBorderInsets(component); width += insets.left + insets.right; } Insets insets = component.getInsets(); if (insets != null) { width += insets.left + insets.right; } if (icon != null) { width += icon.getIconWidth() + component.getIconTextGap(); } return width; }