public void paint(JComponent c, Graphics g, int x, int y) {
		if (icon != null) {
			icon.paintIcon(null, g, x, -fontMetrics.getHeight());
			x += icon.getIconWidth();
		}

		g.setFont(fontMetrics.getFont());
		if (isUnderlined) {
			g.setColor(underlineColor);

			int descent = fontMetrics.getDescent();
			g.fillRect(x, descent - UNDERLINE_HEIGHT, getStringWidth(), UNDERLINE_HEIGHT);
		}

		g.setColor(textColor);
		GraphicsUtils.drawString(c, g, text, x, 0);
	}
Creates an attributed string with the given text, color, icon and metrics with
other attributes, like highlighting and underlining.

@param icon icon image to be displayed to the left of the text
@param text The text that this class describes.
@param textColor The color to paint the text.
@param fontMetrics The font metrics used to draw the text.
@param underline True if <code>text</code> should be underlined.
@param underlineColor the color to use for underlining.
Ghidra/Framework/Docking/src/main/java/docking/widgets/fieldpanel/field/AttributedString.java