BalloonBuilder (@NotNull Html html, @Nullable Icon icon, Color textColor, Color fillColor, @Nullable HyperlinkListener listener) { if (textColor == null) { textColor = MessageType.INFO.getTitleForeground(); } if (fillColor == null) { fillColor = MessageType.INFO.getPopupBackground(); } JEditorPane text = IdeTooltipManager.initPane(html, new HintHint().setTextFg(textColor).setAwtTooltip(true), null, true); if (listener != null) { text.addHyperlinkListener(listener); } text.setEditable(false); NonOpaquePanel.setTransparent(text); text.setBorder(null); JLabel label = new JLabel(); final JPanel content = new NonOpaquePanel(new BorderLayout((int)(label.getIconTextGap() * 1.5), (int)(label.getIconTextGap() * 1.5))); final NonOpaquePanel textWrapper = new NonOpaquePanel(new BorderLayout()); JScrollPane scrolledText = ScrollPaneFactory.createScrollPane(text, true); scrolledText.setBackground(fillColor); scrolledText.getViewport().setBackground(fillColor); textWrapper.add(scrolledText, BorderLayout.CENTER); content.add(textWrapper, BorderLayout.CENTER); if (icon != null) { final NonOpaquePanel north = new NonOpaquePanel(new BorderLayout()); north.add(new JLabel(icon), BorderLayout.NORTH); content.add(north, BorderLayout.WEST); } content.setBorder(JBUI.Borders.empty(2, 4)); final BalloonBuilder builder = createBalloonBuilder(content); builder.setFillColor(fillColor); return builder; }