void (Graphics2D g) { final Icon crumbIcon = crumb.getIcon(); if (crumbIcon != null && (crumbIcon.getIconWidth() != crumbIconWidth || crumbIcon.getIconHeight() != crumbIconHeight)) { // process size change for IconDeferrer (lazy calculated on pool thread) Breadcrumbs.this.revalidate(); Breadcrumbs.this.repaint(); return; } int scale = getScale(); if (path != null) { if (background != null) { g.setColor(background); g.fill(path); } if (parent != null && parent.background == background && !Registry.is("editor.breadcrumbs.marker")) { Graphics2D g2 = (Graphics2D)g.create(); float stroke = JBUIScale.getFontScale(getFontSize(getFont())); // calculate a visible width of separator (30% of a whole path) int delta = (int)(scale * (.3 * getRightGap() + getLeftGap())); g2.clipRect(bounds.x - delta, bounds.y, Short.MAX_VALUE, bounds.height); g2.setPaint(getForeground()); if (stroke > 1) g2.setStroke(new BasicStroke(stroke)); g2.draw(createPath(scale, false)); g2.dispose(); } } if (effectType == EffectType.ROUNDED_BOX && effectColor != null) { Rectangle bounds = getBounds(scale, scale); RectanglePainter.paint(g, bounds.x, bounds.y, bounds.width, bounds.height, bounds.height / 2, background, effectColor); } else if (effectType == EffectType.BOXED && effectColor != null) { Rectangle bounds = getBounds(scale, scale); RectanglePainter.paint(g, bounds.x, bounds.y, bounds.width, bounds.height, 0, background, effectColor); } else if (background != null) { g.setColor(background); g.fillRect(bounds.x, bounds.y, bounds.width, bounds.height); if (isSelected(crumb)) { paintMarker(g, bounds.x, bounds.y, bounds.width, bounds.height, crumb, scale * 2); } } else if (isSelected(crumb)) { paintMarker(g, bounds.x, bounds.y, bounds.width, bounds.height, crumb, scale * 2); } else if (isHovered(crumb)) { paintMarker(g, bounds.x, bounds.y, bounds.width, bounds.height, crumb, scale); } if (font != null && foreground != null) { g.setFont(font); FontMetrics fm = getFontMetrics(font); if (fm != null) { Rectangle iconR = new Rectangle(); Rectangle textR = new Rectangle(); Rectangle viewR = getBounds(scale * LEFT_RIGHT, scale * TOP_BOTTOM); String text = layout(fm, iconR, textR, viewR); if (!StringUtil.isEmpty(text)) { g.setColor(foreground); g.drawString(text, textR.x, textR.y += fm.getAscent()); if (effectColor != null && effectType != null) { EffectPainter painter = getEffectPainter(effectType); if (painter != null) { g.setColor(effectColor); textR.height = painter == EffectPainter.STRIKE_THROUGH ? fm.getAscent() : fm.getDescent(); painter.paint(g, textR.x, textR.y, textR.width, textR.height, font); } } } if (icon != null) { icon.paintIcon(Breadcrumbs.this, g, iconR.x, iconR.y); } } } }