ComponentPopupBuilder (boolean isWarning, @Nullable Consumer<? super JEditorPane> configurator) { JEditorPane tipComponent = new JEditorPane(); tipComponent.setContentType("text/html"); tipComponent.setEditable(false); tipComponent.setEditorKit(HTMLEditorKitBuilder.simple()); EditorKit kit = tipComponent.getEditorKit(); if (kit instanceof HTMLEditorKit) { StyleSheet css = ((HTMLEditorKit)kit).getStyleSheet(); css.addRule("a, a:link {color:#" + ColorUtil.toHex(JBUI.CurrentTheme.Link.Foreground.ENABLED) + ";}"); css.addRule("a:visited {color:#" + ColorUtil.toHex(JBUI.CurrentTheme.Link.Foreground.VISITED) + ";}"); css.addRule("a:hover {color:#" + ColorUtil.toHex(JBUI.CurrentTheme.Link.Foreground.HOVERED) + ";}"); css.addRule("a:active {color:#" + ColorUtil.toHex(JBUI.CurrentTheme.Link.Foreground.PRESSED) + ";}"); css.addRule("body {background-color:#" + ColorUtil.toHex(isWarning ? warningBackgroundColor() : errorBackgroundColor()) + ";}"); } if (tipComponent.getCaret() instanceof DefaultCaret) { ((DefaultCaret)tipComponent.getCaret()).setUpdatePolicy(DefaultCaret.NEVER_UPDATE); } tipComponent.setCaretPosition(0); tipComponent.setBackground(isWarning ? warningBackgroundColor() : errorBackgroundColor()); tipComponent.setOpaque(true); tipComponent.setBorder(getBorder()); if (configurator != null) { configurator.accept(tipComponent); } return JBPopupFactory.getInstance().createComponentPopupBuilder(tipComponent, null). setBorderColor(isWarning ? warningBorderColor() : errorBorderColor()). setCancelOnClickOutside(false). setShowShadow(true); }