/**
   * Builds and returns a wizard button bar. It consists of some left aligned buttons, the back,
   * next group, and some right aligned buttons. To allow the finish button to overlay the next
   * button, you can optionally provide the <code>overlayedFinish</code> parameter.
   *
   * @param leftAlignedButtons an optional array of buttons that will be positioned in the bar's
   *     left hand side
   * @param back the mandatory back button
   * @param next the mandatory next button
   * @param overlaidFinish the optional overlaid finish button
   * @param rightAlignedButtons an optional array of buttons that will be located in the bar's right
   *     hand side
   * @return a wizard button bar with back, next and a bunch of buttons
   */
  public static JPanel buildWizardBar(
      JButton[] leftAlignedButtons,
      JButton back,
      JButton next,
      JButton overlaidFinish,
      JButton[] rightAlignedButtons) {

    MyButtonBarBuilder2 builder = new MyButtonBarBuilder2();
    if (leftAlignedButtons != null) {
      builder.addButton(leftAlignedButtons);
      builder.addRelatedGap();
    }
    builder.addGlue();
    builder.addButton(back);
    builder.addButton(next);

    // Optionally overlay the finish and next button.
    if (overlaidFinish != null) {
      builder.getPanel().add(overlaidFinish, CC.xy(builder.getColumn(), 1));
    }

    if (rightAlignedButtons != null) {
      builder.addRelatedGap();
      builder.addButton(rightAlignedButtons);
    }
    return builder.getPanel();
  }
  private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
    // Generated using JFormDesigner Evaluation license - Andrey Lubchuck
    dialogPane = new JPanel();
    contentPanel = new JPanel();
    scrollPane1 = new JScrollPane();
    textPane1 = new JTextPane();
    button1 = new JButton();
    buttonBar = new JPanel();
    okButton = new JButton();
    cancelButton = new JButton();

    // ======== this ========
    Container contentPane = getContentPane();
    contentPane.setLayout(new BorderLayout());

    // ======== dialogPane ========
    {
      dialogPane.setBorder(Borders.createEmptyBorder("7dlu, 7dlu, 7dlu, 7dlu"));

      // JFormDesigner evaluation mark
      dialogPane.setBorder(
          new javax.swing.border.CompoundBorder(
              new javax.swing.border.TitledBorder(
                  new javax.swing.border.EmptyBorder(0, 0, 0, 0),
                  "JFormDesigner Evaluation",
                  javax.swing.border.TitledBorder.CENTER,
                  javax.swing.border.TitledBorder.BOTTOM,
                  new java.awt.Font("Dialog", java.awt.Font.BOLD, 12),
                  java.awt.Color.red),
              dialogPane.getBorder()));
      dialogPane.addPropertyChangeListener(
          new java.beans.PropertyChangeListener() {
            public void propertyChange(java.beans.PropertyChangeEvent e) {
              if ("border".equals(e.getPropertyName())) throw new RuntimeException();
            }
          });

      dialogPane.setLayout(new BorderLayout());

      // ======== contentPanel ========
      {
        contentPanel.setLayout(
            new FormLayout("17*(default, $lcgap), default", "6*(default, $lgap), default"));

        // ======== scrollPane1 ========
        {
          scrollPane1.setViewportView(textPane1);
        }
        contentPanel.add(scrollPane1, CC.xywh(4, 5, 12, 1));

        // ---- button1 ----
        button1.setText("text");
        button1.setMaximumSize(new Dimension(83, 23));
        button1.setMinimumSize(new Dimension(83, 23));
        contentPanel.add(button1, CC.xywh(21, 11, 11, 1, CC.CENTER, CC.DEFAULT));
      }
      dialogPane.add(contentPanel, BorderLayout.NORTH);

      // ======== buttonBar ========
      {
        buttonBar.setBorder(Borders.createEmptyBorder("5dlu, 0dlu, 0dlu, 0dlu"));
        buttonBar.setLayout(
            new FormLayout("$lcgap, default, $glue, $button, $rgap, $button", "pref"));

        // ---- okButton ----
        okButton.setText("OK");
        buttonBar.add(okButton, CC.xy(4, 1));

        // ---- cancelButton ----
        cancelButton.setText("Cancel");
        cancelButton.setMaximumSize(new Dimension(85, 23));
        cancelButton.setMinimumSize(new Dimension(85, 23));
        buttonBar.add(cancelButton, CC.xy(6, 1));
      }
      dialogPane.add(buttonBar, BorderLayout.SOUTH);
    }
    contentPane.add(dialogPane, BorderLayout.CENTER);
    pack();
    setLocationRelativeTo(getOwner());
    // JFormDesigner - End of component initialization  //GEN-END:initComponents
  }