JTextPane (@NotNull JTextPane messageComponent, @Nullable @DialogMessage String message, @Nullable UIUtil.FontSize fontSize) { UIUtil.FontSize fixedFontSize = fontSize == null ? UIUtil.FontSize.NORMAL : fontSize; messageComponent.setFont(UIUtil.getLabelFont(fixedFontSize)); if (BasicHTML.isHTMLString(message)) { messageComponent.setEditorKit(HTMLEditorKitBuilder.simple()); } messageComponent.setText(message); messageComponent.setEditable(false); if (messageComponent.getCaret() != null) { messageComponent.setCaretPosition(0); } messageComponent.setBackground(UIUtil.getOptionPaneBackground()); messageComponent.setForeground(UIUtil.getLabelForeground()); return messageComponent; }