JComponent (@Nls @NotNull String text) { JPanel warningPanel = new JPanel(); warningPanel.setLayout(new BoxLayout(warningPanel, BoxLayout.LINE_AXIS)); JLabel warnIcon = new JLabel(AllIcons.General.Warning); warnIcon.setAlignmentY(Component.TOP_ALIGNMENT); warnIcon.setBorder(JBUI.Borders.emptyRight(5)); warningPanel.add(warnIcon); JLabel textLabel = new JLabel(text); textLabel.setAlignmentY(Component.TOP_ALIGNMENT); textLabel.setFont(JBUI.Fonts.smallFont()); warningPanel.add(textLabel); return warningPanel; }