JComponent (@NlsContexts.PopupTitle @NotNull String titleText, @NotNull Color background) { JLabel titleLabel = new JLabel(StringUtil.capitalizeWords(titleText, true)); titleLabel.setFont(getTitleFont()); titleLabel.setForeground(UIUtil.getLabelDisabledForeground()); SeparatorComponent separatorComponent = new SeparatorComponent(titleLabel.getPreferredSize().height / 2, new JBColor(Gray._220, Gray._80), null); JPanel panel = new JPanel(new BorderLayout()); panel.add(titleLabel, BorderLayout.WEST); panel.add(separatorComponent, BorderLayout.CENTER); panel.setBorder(JBUI.Borders.empty(3)); titleLabel.setBorder(JBUI.Borders.emptyRight(3)); panel.setBackground(background); return panel; }