void (@NotNull Graphics2D g2, int x, int y, int height) { if (myLabels.isEmpty()) return; GraphicsConfig config = GraphicsUtil.setupAAPainting(g2) .setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, getFractionalMetricsValue()) .setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, getTextAntiAliasingValue()); g2.setFont(getReferenceFont()); g2.setStroke(new BasicStroke(1.5f)); FontMetrics fontMetrics = g2.getFontMetrics(); int baseLine = SimpleColoredComponent.getTextBaseLine(fontMetrics, height); g2.setColor(myBackground); g2.fillRect(x, y, myWidth, height); if (myGreyBackground != null && myCompact) { g2.setColor(myGreyBackground); g2.fillRect(x, y + baseLine - fontMetrics.getAscent() - TOP_TEXT_PADDING.get(), myWidth, fontMetrics.getHeight() + TOP_TEXT_PADDING.get() + BOTTOM_TEXT_PADDING.get()); } x += LEFT_PADDING.get(); for (Pair<String, LabelIcon> label : myLabels) { LabelIcon icon = label.second; String text = label.first; if (myGreyBackground != null && !myCompact) { g2.setColor(myGreyBackground); g2.fill(new RoundRectangle2D.Double(x - MIDDLE_PADDING.get() / 3, y + baseLine - fontMetrics.getAscent() - TOP_TEXT_PADDING.get(), icon.getIconWidth() + fontMetrics.stringWidth(text) + 2 * MIDDLE_PADDING.get() / 3, fontMetrics.getHeight() + TOP_TEXT_PADDING.get() + BOTTOM_TEXT_PADDING.get(), LABEL_ARC.get(), LABEL_ARC.get())); } icon.paintIcon(null, g2, x, y + (height - icon.getIconHeight()) / 2); x += icon.getIconWidth(); x += getIconTextPadding(); g2.setColor(myForeground); g2.drawString(text, x, y + baseLine); x += fontMetrics.stringWidth(text) + (myCompact ? COMPACT_MIDDLE_PADDING.get() : MIDDLE_PADDING.get()); } config.restore(); }