void () { icon = crumb.getIcon(); if (icon != null) { crumbIconWidth = icon.getIconWidth(); crumbIconHeight = icon.getIconHeight(); } else { crumbIconWidth = 0; crumbIconHeight = 0; } text = crumb.getText(); font = getFont(crumb); foreground = getForeground(crumb); background = getBackground(crumb); effectType = getEffectType(crumb); effectColor = getEffectColor(crumb); // use shared foreground and font if not set if (foreground == null) foreground = getForeground(); if (font == null) font = getFont(); // scale loaded icon by font if (icon != null) icon = IconUtil.scaleByFont(icon, Breadcrumbs.this, getFontSize(font)); // calculate preferred size int scale = getScale(); preferred.width = scale * (LEFT_RIGHT + LEFT_RIGHT + getLeftGap() + getRightGap()); preferred.height = scale * (TOP_BOTTOM + TOP_BOTTOM); if (font != null && !StringUtil.isEmpty(text)) { FontMetrics fm = getFontMetrics(font); Rectangle iconR = new Rectangle(); Rectangle textR = new Rectangle(); layout(fm, iconR, textR, new Rectangle(Short.MAX_VALUE, Short.MAX_VALUE)); preferred.width += Math.max(iconR.x + iconR.width, textR.x + textR.width) - Math.min(iconR.x, textR.x); preferred.height += Math.max(iconR.y + iconR.height, textR.y + textR.height) - Math.min(iconR.y, textR.y); } else if (icon != null) { preferred.width += icon.getIconWidth(); preferred.height += icon.getIconHeight(); } }