JPanel () { JPanel tipPanel = new JPanel(); tipPanel.setLayout(new VerticalLayout(JBUI.getInt("HelpTooltip.verticalGap", 4))); tipPanel.setBackground(UIUtil.getToolTipBackground()); String currentTitle = title != null ? title.get() : null; boolean hasTitle = Strings.isNotEmpty(currentTitle); boolean hasDescription = Strings.isNotEmpty(description); if (hasTitle) { tipPanel.add(new Header(hasDescription), VerticalLayout.TOP); } if (hasDescription) { @Nls String[] pa = description.split(PARAGRAPH_SPLITTER); isMultiline = pa.length > 1; for (String p : pa) { if (!p.isEmpty()) { //noinspection HardCodedStringLiteral tipPanel.add(new Paragraph(p, hasTitle), VerticalLayout.TOP); } } } if (!hasTitle && Strings.isNotEmpty(shortcut)) { JLabel shortcutLabel = new JLabel(shortcut); shortcutLabel.setFont(deriveDescriptionFont(shortcutLabel.getFont(), false)); shortcutLabel.setForeground(JBUI.CurrentTheme.Tooltip.shortcutForeground()); tipPanel.add(shortcutLabel, VerticalLayout.TOP); } if (link != null && linkOriginalFontScaler != null) { link.setForeground(LINK_COLOR); link.setFont(deriveDescriptionFont(linkOriginalFontScaler.scaledFont(), hasTitle)); tipPanel.add(link, VerticalLayout.TOP); } isMultiline = isMultiline || Strings.isNotEmpty(description) && (Strings.isNotEmpty(currentTitle) || link != null); tipPanel.setBorder(textBorder(isMultiline)); return tipPanel; }