Package com.jgoodies.forms.builder

Examples of com.jgoodies.forms.builder.ButtonBarBuilder


     * @param help     the help button to add on the left side
     * @param buttons  an array of buttons to add
     * @return a right aligned button bar with the given buttons
     */
    public static JPanel buildHelpBar(JButton help, JButton[] buttons) {
        ButtonBarBuilder builder = new ButtonBarBuilder();
        builder.addGridded(help);
        builder.addRelatedGap();
        builder.addGlue();
        builder.addGriddedButtons(buttons);
        return builder.getPanel();
    }
View Full Code Here


     * @param properties    the Properties button
     * @return a panel that contains the button(s)
     */
    public static JPanel buildAddRemovePropertiesBar(
            JButton add, JButton remove, JButton properties) {
        ButtonBarBuilder builder = new ButtonBarBuilder();
        builder.addGriddedGrowing(add);
        builder.addRelatedGap();
        builder.addGriddedGrowing(remove);
        builder.addRelatedGap();
        builder.addGriddedGrowing(properties);
        return builder.getPanel();
    }
View Full Code Here

                                         JButton back,
                                         JButton next,
                                         JButton overlaidFinish,
                                         JButton[] rightAlignedButtons) {

        ButtonBarBuilder builder = new ButtonBarBuilder();
        if (leftAlignedButtons != null) {
            builder.addGriddedButtons(leftAlignedButtons);
            builder.addRelatedGap();
        }
        builder.addGlue();
        builder.addGridded(back);
        builder.addGridded(next);

        // Optionally overlay the finish and next button.
        if (overlaidFinish != null) {
            builder.nextColumn(-1);
            builder.add(overlaidFinish);
            builder.nextColumn();
        }

        if (rightAlignedButtons != null) {
            builder.addRelatedGap();
            builder.addGriddedButtons(rightAlignedButtons);
        }
        return builder.getPanel();
    }
View Full Code Here

class ErrorsDialog extends JDialog{
  public ErrorsDialog(Frame frame, java.util.List errors, String titleText){
    super(frame, "DVModeler :: " + titleText, false);

    ButtonBarBuilder buttonPanelBuilder = new ButtonBarBuilder();
    buttonPanelBuilder.addGlue();

    //button
    JButton okButton = new JButton("Ok");
    okButton.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        setVisible(false);
      }
    });

    buttonPanelBuilder.addGridded(okButton);
    getRootPane().setDefaultButton(okButton);


    //Put everything together, using the content pane's BorderLayout.
    Container contentPane = getContentPane();
        FormLayout layout = new FormLayout(
                        "fill:pref:grow",
                        "fill:p:grow, 5dlu, p");

    PanelBuilder mainPanelBuilder = new PanelBuilder(layout);
    CellConstraints cc = new CellConstraints();
    mainPanelBuilder.setDefaultDialogBorder();

    ErrorsPanel errorsPanel = new ErrorsPanel(errors, "SaveErrors" + ":");

    mainPanelBuilder.add(errorsPanel,    cc.xy(1, 1));
    mainPanelBuilder.add(buttonPanelBuilder.getPanel(),   cc.xy(1, 3));
    contentPane.add(mainPanelBuilder.getPanel());
    pack();

    this.setLocationRelativeTo(null);
View Full Code Here

        selectedValue = CANCEL;
        setVisible(false);
      }
    });

    ButtonBarBuilder builder = new ButtonBarBuilder();
    builder.addGlue();

    //buttons

    JButton saveAnywayButton = new JButton("Save Anyway");
    saveAnywayButton.addActionListener(new ActionListener(){
      public void actionPerformed(ActionEvent e){
        selectedValue = SAVE_ANYWAY;
        setVisible(false);
      }
    });

    builder.addGridded(saveAnywayButton);


    JButton cancelButton = new JButton("Cancel");
      cancelButton.addActionListener(new ActionListener(){
        public void actionPerformed(ActionEvent e){
          selectedValue = CANCEL;
          setVisible(false);
        }
      });


     getRootPane().setDefaultButton(saveAnywayButton);

    if (dialogType.equals(SaveErrorsDialog.EXIT_DIALOG)){

      JButton exitWithoutSavingButton = new JButton("Exit Whithout Saving");
      exitWithoutSavingButton.addActionListener(new ActionListener(){
        public void actionPerformed(ActionEvent e){
          selectedValue = EXIT_WITHOUT_SAVING;
          setVisible(false);
        }
      });

      builder.addRelatedGap();
      builder.addGridded(exitWithoutSavingButton);
      builder.addRelatedGap();
      builder.addGridded(cancelButton);

    } else if (dialogType.equals(SaveErrorsDialog.CLOSE_DIALOG)){

      JButton closeWithoutSavingButton = new JButton("Close Whithout Saving");
      closeWithoutSavingButton.addActionListener(new ActionListener(){
        public void actionPerformed(ActionEvent e){
          selectedValue = CLOSE_WITHOUT_SAVING;
          setVisible(false);
        }
      });

      builder.addRelatedGap();
      builder.addGridded(closeWithoutSavingButton);
      builder.addRelatedGap();
      builder.addGridded(cancelButton);

    } else if (dialogType.equals(SaveErrorsDialog.SAVE_DIALOG)){

      builder.addRelatedGap();
      builder.addGridded(cancelButton);
    }

    JPanel buttonPane = new JPanel();

    buttonPane = builder.getPanel();


    //Put everything together, using the content pane's BorderLayout.
    Container contentPane = getContentPane();
View Full Code Here

            {
                chDoNotShow = ComponentsFactory.createCheckBox(Strings.message("do.not.show.this.dialog.again"));
                chDoNotShow.setSelected(false);
            }

            ButtonBarBuilder builder = new ButtonBarBuilder();
            builder.setDefaultButtonBarGapBorder();
            if (proactive) builder.addFixed(chDoNotShow);
            builder.addUnrelatedGap();
            builder.addGlue();
            builder.addUnrelatedGap();
            builder.addGridded(createCloseButton(true));
            return builder.getPanel();
        }
View Full Code Here

     * @return panel.
     */
    private Component buildMainPanel()
    {
        // Buttons
        ButtonBarBuilder buttons = new ButtonBarBuilder();
        buttons.addFixed(btnNew);
        buttons.addRelatedGap();
        buttons.addFixed(btnCopy);
        buttons.addRelatedGap();
        buttons.addFixed(btnDelete);

        // --- Panel construction
        BBFormBuilder builder = new BBFormBuilder("p, 2dlu, max(50dlu;p):grow, 7dlu, p, 0dlu:grow");

        // First row
        builder.append(STR_TEMPLATE, cbTemplates);
        builder.append(buttons.getPanel());

        // Editor
        builder.appendRelatedComponentsGapRow();
        builder.appendRow("200px:grow");
        builder.nextLine(2);
View Full Code Here

        {
            btnOK = createOKButton(true);
            btnOK.setAction(new TestBlogSetupAction());
            btnCancel = createCancelButton();

            ButtonBarBuilder builder = new ButtonBarBuilder();

            builder.getPanel().setBorder(Constants.DIALOG_BUTTON_BAR_BORDER);
            builder.addFixed(spnProgress);
            builder.addUnrelatedGap();
            builder.addGlue();
            builder.addGriddedButtons(new JButton[] { btnOK, btnCancel });

            return builder.getPanel();
        }
View Full Code Here

     *
     * @return bar.
     */
    private Component buildButtonBar()
    {
        ButtonBarBuilder builder = new ButtonBarBuilder();
        builder.addGriddedButtons(new JButton[] {btnSave, btnRevert});
        builder.addGlue();
        builder.addGridded(createCloseButton(true));

        return builder.getPanel();
    }
View Full Code Here

        private JComponent buildButtonBar()
        {
            JCheckBox showTipsCheckBox = new JCheckBox(Strings.message("ui.tip.of.the.day.show.on.startup"));
            showTipsCheckBox.setModel(createShowTipsButtonModel(showingTipsModel()));

            ButtonBarBuilder builder = new ButtonBarBuilder();
            builder.setDefaultButtonBarGapBorder();
            builder.addFixed(showTipsCheckBox);
            builder.addUnrelatedGap();
            builder.addGlue();
            builder.addGridded(createBackButton());
            builder.addGridded(createNextButton());
            builder.addUnrelatedGap();
            builder.addGridded(createCloseButton(true));
            return builder.getPanel();
        }
View Full Code Here

TOP

Related Classes of com.jgoodies.forms.builder.ButtonBarBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.