int (LookupElement item, Color foreground, final LookupElementPresentation presentation, int allowedWidth, boolean selected, boolean nonFocusedSelection, FontMetrics normalMetrics) { final String givenText = presentation.getTypeText(); final String labelText = trimLabelText(StringUtil.isEmpty(givenText) ? "" : " " + givenText, allowedWidth, normalMetrics); int used = getStringWidth(labelText, normalMetrics); final Icon icon = presentation.getTypeIcon(); if (icon != null) { myTypeLabel.setIcon(icon); used += icon.getIconWidth(); } myTypeLabel.append(labelText); myTypeLabel.setForeground(getTypeTextColor(item, foreground, presentation, selected, nonFocusedSelection)); myTypeLabel.setIconOnTheRight(presentation.isTypeIconRightAligned()); return used; }