JPanel (@NotNull List<? extends JButton> leftSideButtons, @NotNull List<? extends JButton> rightSideButtons, boolean addHelpToLeftSide) { JPanel panel = new SouthPanel(getStyle()); if (myDoNotAsk != null) { myCheckBoxDoNotShowDialog = new JCheckBox(myDoNotAsk.getDoNotShowMessage()); myCheckBoxDoNotShowDialog.setVisible(myDoNotAsk.canBeHidden()); myCheckBoxDoNotShowDialog.setSelected(!myDoNotAsk.isToBeShown()); DialogUtil.registerMnemonic(myCheckBoxDoNotShowDialog, '&'); } JComponent doNotAskCheckbox = createDoNotAskCheckbox(); JPanel lrButtonsPanel = new NonOpaquePanel(new GridBagLayout()); Insets insets = JBInsets.emptyInsets(); if (!rightSideButtons.isEmpty() || !leftSideButtons.isEmpty()) { GridBag bag = new GridBag().setDefaultInsets(insets); if (!leftSideButtons.isEmpty()) { JPanel buttonsPanel = createButtonsPanel(leftSideButtons); if (!rightSideButtons.isEmpty()) { buttonsPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 20)); // leave some space between button groups } lrButtonsPanel.add(buttonsPanel, bag.next()); } lrButtonsPanel.add(Box.createHorizontalGlue(), bag.next().weightx(1).fillCellHorizontally()); // left strut if (!rightSideButtons.isEmpty()) { JPanel buttonsPanel = createButtonsPanel(rightSideButtons); if (shouldAddErrorNearButtons()) { lrButtonsPanel.add(myErrorText, bag.next()); lrButtonsPanel.add(Box.createHorizontalStrut(10), bag.next()); } lrButtonsPanel.add(buttonsPanel, bag.next()); } if (SwingConstants.CENTER == myButtonAlignment && doNotAskCheckbox == null) { lrButtonsPanel.add(Box.createHorizontalGlue(), bag.next().weightx(1).fillCellHorizontally()); // right strut } } JComponent helpButton = null; if (addHelpToLeftSide) { helpButton = createHelpButton(insets); } JPanel eastPanel = createSouthAdditionalPanel(); if (helpButton != null || doNotAskCheckbox != null || eastPanel != null) { JPanel leftPanel = new JPanel(new BorderLayout()); if (helpButton != null) leftPanel.add(helpButton, BorderLayout.WEST); if (doNotAskCheckbox != null) { doNotAskCheckbox.setBorder(JBUI.Borders.emptyRight(20)); leftPanel.add(doNotAskCheckbox, BorderLayout.CENTER); } if(eastPanel != null) { leftPanel.add(eastPanel, BorderLayout.EAST); } panel.add(leftPanel, BorderLayout.WEST); } panel.add(lrButtonsPanel, BorderLayout.CENTER); if (getStyle() == DialogStyle.COMPACT) { Color color = UIManager.getColor("DialogWrapper.southPanelDivider"); Border line = new CustomLineBorder(color != null ? color : OnePixelDivider.BACKGROUND, 1, 0, 0, 0); panel.setBorder(new CompoundBorder(line, JBUI.Borders.empty(8, 12))); } else { panel.setBorder(JBUI.Borders.emptyTop(8)); } return panel; }