Search in sources :

Example 31 with ButtonBarBuilder

use of com.jgoodies.forms.builder.ButtonBarBuilder in project jgnash by ccavanaugh.

the class SplitsDialog method layoutMainPanel.

private void layoutMainPanel() {
    initComponents();
    FormLayout layout = new FormLayout("d:g", "80dlu:g");
    DefaultFormBuilder builder = new DefaultFormBuilder(layout);
    builder.border(Borders.DIALOG);
    builder.append(new JScrollPane(table));
    // build the button bar
    ButtonBarBuilder bbb = new ButtonBarBuilder();
    bbb.addButton(newButton, deleteButton);
    bbb.addUnrelatedGap();
    bbb.addGlue();
    bbb.addButton(deleteAllButton);
    builder.append(bbb.getPanel());
    builder.nextLine();
    builder.append(concatenateMemoCheckBox);
    builder.nextLine();
    builder.append(tabbedPane);
    builder.nextLine();
    builder.appendUnrelatedComponentsGapRow();
    builder.nextLine();
    builder.append(StaticUIMethods.buildOKCancelBar(okButton, cancelButton));
    getContentPane().add(builder.getPanel(), BorderLayout.CENTER);
}
Also used : FormLayout(com.jgoodies.forms.layout.FormLayout) JScrollPane(javax.swing.JScrollPane) DefaultFormBuilder(com.jgoodies.forms.builder.DefaultFormBuilder) ButtonBarBuilder(com.jgoodies.forms.builder.ButtonBarBuilder)

Example 32 with ButtonBarBuilder

use of com.jgoodies.forms.builder.ButtonBarBuilder in project jgnash by ccavanaugh.

the class BudgetGoalDialog method layoutMainPanel.

private void layoutMainPanel() {
    FormLayout contentLayout = new FormLayout("fill:p:g, $lcgap, fill:p", "f:p:g, $ugap, f:p");
    JPanel contentPanel = new JPanel(contentLayout);
    DefaultFormBuilder contentBuilder = new DefaultFormBuilder(contentLayout, contentPanel);
    contentBuilder.border(Borders.DIALOG);
    FormLayout layout = new FormLayout("right:d, $lcgap, fill:p:g", "f:p, $rgap, d, $ugap, f:p:g");
    DefaultFormBuilder builder = new DefaultFormBuilder(layout);
    cancelButton = new JButton(rb.getString("Button.Cancel"));
    okButton = new JButton(rb.getString("Button.Ok"));
    historicalButton = new JButton(rb.getString("Button.HistoricalFill"));
    fillAmountField = new JFloatField(account.getCurrencyNode());
    fillAmountField.setDecimal(BigDecimal.ZERO);
    fillPatternAmountField = new JFloatField(account.getCurrencyNode());
    fillPatternAmountField.setDecimal(BigDecimal.ZERO);
    fillButton = new JButton(rb.getString("Button.Enter"));
    fillPatternEnterButton = new JButton(rb.getString("Button.Enter"));
    budgetPeriodCombo = new JComboBox<>();
    budgetPeriodCombo.setModel(new DefaultComboBoxModel<>(Period.values()));
    budgetPeriodCombo.setSelectedItem(getBudgetGoal().getBudgetPeriod());
    patternComboBox = new JComboBox<>();
    patternComboBox.setModel(new DefaultComboBoxModel<>(Pattern.values()));
    int max = getDescriptors().size();
    startRowSpinner = new JSpinner(new SpinnerNumberModel(1, 1, max, 1));
    endRowSpinner = new JSpinner(new SpinnerNumberModel(max, 1, max, 1));
    builder.append(new JLabel(rb.getString("Label.Period")), budgetPeriodCombo);
    builder.nextLine();
    builder.nextLine();
    builder.append(new JLabel(rb.getString("Label.Currency")), new JLabel(account.getCurrencyNode().getSymbol()));
    builder.nextLine();
    builder.nextLine();
    JTable table = new GoalTable(model);
    table.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    // save entry if focus is lost
    table.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
    ToolTipManager.sharedInstance().unregisterComponent(table);
    JScrollPane scrollPane = new JScrollPane(table);
    // force it something small so it will resize correctly
    scrollPane.setPreferredSize(new Dimension(SCROLLPANE_WIDTH, SCROLLPANE_HEIGHT));
    builder.append(scrollPane, 3);
    JPanel patternPanel = new JPanel();
    patternPanel.setLayout(new FormLayout(new ColumnSpec[] { FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow") }, new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC }));
    patternPanel.add(new JLabel(rb.getString("Label.Pattern")), "1, 2, right, default");
    patternPanel.add(patternComboBox, "3, 2, fill, default");
    patternPanel.add(new JLabel(rb.getString("Label.StartRow")), "1, 4, right, default");
    patternPanel.add(startRowSpinner, "3, 4");
    patternPanel.add(new JLabel(rb.getString("Label.EndRow")), "1, 6, right, default");
    patternPanel.add(endRowSpinner, "3, 6");
    patternPanel.add(new JLabel(rb.getString("Label.Amount")), "1, 8, right, default");
    patternPanel.add(fillPatternAmountField, "3, 8, fill, default");
    patternPanel.add(new ButtonBarBuilder().addGlue().addButton(fillPatternEnterButton).build(), "3, 10");
    FormLayout fillLayout = new FormLayout("right:d, $lcgap, fill:max(48dlu;min):g, $lcgap, d", "d, $rgap, d, $rgap, d, $rgap, d, $rgap, d");
    DefaultFormBuilder fillBuilder = new DefaultFormBuilder(fillLayout);
    fillBuilder.border(new TitledBorder(rb.getString("Title.SmartFill")));
    fillBuilder.append(historicalButton, 5);
    fillBuilder.nextLine();
    fillBuilder.nextLine();
    fillBuilder.appendSeparator();
    fillBuilder.nextLine();
    fillBuilder.nextLine();
    fillBuilder.append(new JLabel(rb.getString("Label.FillAll")), fillAmountField, fillButton);
    fillBuilder.nextLine();
    fillBuilder.nextLine();
    fillBuilder.appendSeparator();
    fillBuilder.nextLine();
    fillBuilder.nextLine();
    fillBuilder.append(patternPanel, 5);
    budgetPeriodCombo.addActionListener(this);
    cancelButton.addActionListener(this);
    okButton.addActionListener(this);
    historicalButton.addActionListener(this);
    fillButton.addActionListener(this);
    fillPatternEnterButton.addActionListener(this);
    contentBuilder.append(builder.getPanel(), fillBuilder.getPanel());
    contentBuilder.nextLine();
    contentBuilder.nextLine();
    contentBuilder.append(StaticUIMethods.buildOKCancelBar(okButton, cancelButton), 3);
    getContentPane().add(contentBuilder.getPanel());
    pack();
    setMinimumSize(getSize());
    DialogUtils.addBoundsListener(this);
    // pack columns for better default appearance
    JTableUtils.packGenericTable(table);
}
Also used : FormLayout(com.jgoodies.forms.layout.FormLayout) JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) ColumnSpec(com.jgoodies.forms.layout.ColumnSpec) JFloatField(jgnash.ui.components.JFloatField) JButton(javax.swing.JButton) RowSpec(com.jgoodies.forms.layout.RowSpec) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension) TitledBorder(javax.swing.border.TitledBorder) SpinnerNumberModel(javax.swing.SpinnerNumberModel) DefaultFormBuilder(com.jgoodies.forms.builder.DefaultFormBuilder) ButtonBarBuilder(com.jgoodies.forms.builder.ButtonBarBuilder) JTable(javax.swing.JTable) FormattedJTable(jgnash.ui.components.FormattedJTable) JSpinner(javax.swing.JSpinner)

Example 33 with ButtonBarBuilder

use of com.jgoodies.forms.builder.ButtonBarBuilder in project jgnash by ccavanaugh.

the class CurrencyExchangeDialog method layoutMiddlePanel.

private JPanel layoutMiddlePanel() {
    FormLayout layout = new FormLayout("p, $lcgap, max(55dlu;p), 6dlu, p, $lcgap, max(45dlu;p), p:g", "");
    DefaultFormBuilder builder = new DefaultFormBuilder(layout);
    builder.append(rb.getString("Label.Date"), dateField);
    builder.append(rb.getString("Label.ExchangeRate"), rateField);
    builder.appendUnrelatedComponentsGapRow();
    builder.nextRow();
    builder.append(new ButtonBarBuilder().addButton(addButton, deleteButton, clearButton).build(), 8);
    builder.nextRow();
    builder.appendUnrelatedComponentsGapRow();
    builder.nextRow();
    builder.appendRow(RowSpec.decode("f:p:g"));
    builder.append(new JScrollPane(table), 8);
    return builder.getPanel();
}
Also used : FormLayout(com.jgoodies.forms.layout.FormLayout) JScrollPane(javax.swing.JScrollPane) DefaultFormBuilder(com.jgoodies.forms.builder.DefaultFormBuilder) ButtonBarBuilder(com.jgoodies.forms.builder.ButtonBarBuilder)

Example 34 with ButtonBarBuilder

use of com.jgoodies.forms.builder.ButtonBarBuilder in project jgnash by ccavanaugh.

the class SecurityModifyPanel method layoutButtonPanel.

private JPanel layoutButtonPanel() {
    final ButtonBarBuilder builder = new ButtonBarBuilder();
    builder.addButton(newButton, deleteButton, cancelButton);
    builder.addUnrelatedGap();
    builder.addGlue();
    builder.addButton(applyButton);
    return builder.getPanel();
}
Also used : ButtonBarBuilder(com.jgoodies.forms.builder.ButtonBarBuilder)

Aggregations

ButtonBarBuilder (com.jgoodies.forms.builder.ButtonBarBuilder)34 FormLayout (com.jgoodies.forms.layout.FormLayout)17 JButton (javax.swing.JButton)17 ActionEvent (java.awt.event.ActionEvent)14 AbstractAction (javax.swing.AbstractAction)14 JScrollPane (javax.swing.JScrollPane)13 ActionMap (javax.swing.ActionMap)11 InputMap (javax.swing.InputMap)11 JDialog (javax.swing.JDialog)11 JPanel (javax.swing.JPanel)9 FormBuilder (com.jgoodies.forms.builder.FormBuilder)8 BorderLayout (java.awt.BorderLayout)8 Action (javax.swing.Action)8 DefaultFormBuilder (com.jgoodies.forms.builder.DefaultFormBuilder)6 Dimension (java.awt.Dimension)6 ButtonGroup (javax.swing.ButtonGroup)5 JTextField (javax.swing.JTextField)4 NamedCompound (org.jabref.gui.undo.NamedCompound)4 WindowLocation (org.jabref.gui.util.WindowLocation)4 Insets (java.awt.Insets)3