void (@NotNull JLabel component, @Nullable @NlsContexts.DetailedDescription String commentText, boolean isCommentBelow, int maxLineLength) { if (commentText != null) { @NonNls String css = "<head><style type=\"text/css\">\n" + "a, a:link {color:#" + ColorUtil.toHex(JBUI.CurrentTheme.Link.Foreground.ENABLED) + ";}\n" + "a:visited {color:#" + ColorUtil.toHex(JBUI.CurrentTheme.Link.Foreground.VISITED) + ";}\n" + "a:hover {color:#" + ColorUtil.toHex(JBUI.CurrentTheme.Link.Foreground.HOVERED) + ";}\n" + "a:active {color:#" + ColorUtil.toHex(JBUI.CurrentTheme.Link.Foreground.PRESSED) + ";}\n" + //"body {background-color:#" + ColorUtil.toHex(JBColor.YELLOW) + ";}\n" + // Left for visual debugging "</style>\n</head>"; HtmlChunk text = HtmlChunk.raw(commentText); if (maxLineLength > 0 && commentText.length() > maxLineLength && isCommentBelow) { int width = component.getFontMetrics(component.getFont()).stringWidth(commentText.substring(0, maxLineLength)); text = text.wrapWith(HtmlChunk.div().attr("width", width)); } else { text = text.wrapWith(HtmlChunk.div()); } component.setText(new HtmlBuilder() .append(HtmlChunk.raw(css)) .append(text.wrapWith("body")) .wrapWith("html") .toString()); } }