void (JComponent c, @NotNull String fullText, Graphics2D g, Rectangle textBounds) { FontMetrics metrics = c.getFontMetrics(c.getFont()); g.setColor(c.isEnabled() ? c.getForeground() : UIUtil.getLabelDisabledForeground()); int baseline = c.getBaseline(textBounds.width, textBounds.height); String text = textCutStrategy.calcShownText(fullText, metrics, textBounds.width); Rectangle strBounds = metrics.getStringBounds(text, g).getBounds(); strBounds.setLocation(Math.max(0, (int)(textBounds.getCenterX() - strBounds.getCenterX())), baseline); View v = (View)c.getClientProperty(BasicHTML.propertyKey); if (v != null) { strBounds.y -= metrics.getAscent(); v.paint(g, strBounds); } else { SwingUtilities2.drawString(c, g, text, strBounds.x, strBounds.y); } }