Search in sources :

Example 46 with JSpinner

use of javax.swing.JSpinner in project jgnash by ccavanaugh.

the class MonthTab method layoutMainPanel.

private void layoutMainPanel() {
    FormLayout layout = new FormLayout("right:p, $lcgap, f:p, 2dlu, max(48dlu;min), 2dlu, f:p, 10dlu, right:p, 4dlu, max(48dlu;min)", "f:p, $lgap, f:p, $lgap, f:p");
    layout.setRowGroups(new int[][] { { 1, 3, 5 } });
    setLayout(layout);
    setBorder(Borders.DIALOG);
    CellConstraints cc = new CellConstraints();
    noEndButton = new JRadioButton(rb.getString("Button.NoEndDate"));
    endButton = new JRadioButton();
    endDateField = new DatePanel();
    group.add(noEndButton);
    group.add(endButton);
    numberSpinner = new JSpinner(new SpinnerNumberModel(1, 1, 24, 1));
    typeComboBox = new JComboBox<>();
    typeComboBox.setModel(new DefaultComboBoxModel<>(new String[] { rb.getString("Column.Date"), rb.getString("Column.Day") }));
    add(new JLabel(rb.getString("Label.Every")), cc.xy(1, 1));
    add(numberSpinner, cc.xywh(3, 1, 3, 1));
    add(new JLabel(rb.getString("Tab.Month")), cc.xy(7, 1));
    add(new JLabel(rb.getString("Label.By")), cc.xy(9, 1));
    add(typeComboBox, cc.xy(11, 1));
    add(new JLabel(rb.getString("Label.EndOn")), cc.xy(1, 3));
    add(noEndButton, cc.xyw(3, 3, 5));
    add(endButton, cc.xy(3, 5));
    add(endDateField, cc.xy(5, 5));
}
Also used : FormLayout(com.jgoodies.forms.layout.FormLayout) SpinnerNumberModel(javax.swing.SpinnerNumberModel) JRadioButton(javax.swing.JRadioButton) DatePanel(jgnash.ui.components.DatePanel) JSpinner(javax.swing.JSpinner) JLabel(javax.swing.JLabel) CellConstraints(com.jgoodies.forms.layout.CellConstraints)

Example 47 with JSpinner

use of javax.swing.JSpinner in project jgnash by ccavanaugh.

the class WeekTab method layoutMainPanel.

private void layoutMainPanel() {
    FormLayout layout = new FormLayout("right:p, $lcgap, f:p, 2dlu, max(48dlu;min), $lcgap, f:p, 2dlu, f:d", "f:p, $lgap, f:p, $lgap, f:p");
    layout.setRowGroups(new int[][] { { 1, 3, 5 } });
    setLayout(layout);
    setBorder(Borders.DIALOG);
    CellConstraints cc = new CellConstraints();
    noEndButton = new JRadioButton(rb.getString("Button.NoEndDate"));
    endButton = new JRadioButton();
    endDateField = new DatePanel();
    group.add(noEndButton);
    group.add(endButton);
    numberSpinner = new JSpinner(new SpinnerNumberModel(1, 1, 52, 1));
    add(new JLabel(rb.getString("Label.Every")), cc.xy(1, 1));
    add(numberSpinner, cc.xywh(3, 1, 3, 1));
    add(new JLabel(rb.getString("Tab.Week")), cc.xy(7, 1));
    add(new JLabel(rb.getString("Label.EndOn")), cc.xy(1, 3));
    add(noEndButton, cc.xywh(3, 3, 5, 1));
    add(endButton, cc.xy(3, 5));
    add(endDateField, cc.xy(5, 5));
}
Also used : FormLayout(com.jgoodies.forms.layout.FormLayout) SpinnerNumberModel(javax.swing.SpinnerNumberModel) JRadioButton(javax.swing.JRadioButton) DatePanel(jgnash.ui.components.DatePanel) JSpinner(javax.swing.JSpinner) JLabel(javax.swing.JLabel) CellConstraints(com.jgoodies.forms.layout.CellConstraints)

Example 48 with JSpinner

use of javax.swing.JSpinner in project jgnash by ccavanaugh.

the class GeneralOptions method initComponents.

private void initComponents() {
    animationsEnabled = new JCheckBox(rb.getString("Button.SubstanceAnimations"));
    numButton = new JButton(rb.getString("Menu.EditTranNumList.Name"));
    selectOnFocusCheckBox = new JCheckBox(rb.getString("Button.SelectText"));
    SpinnerModel model = new SpinnerNumberModel(ThemeManager.getNimbusFontSize(), 9, 15, 1);
    nimbusFontSpinner = new JSpinner(model);
}
Also used : JCheckBox(javax.swing.JCheckBox) SpinnerNumberModel(javax.swing.SpinnerNumberModel) JButton(javax.swing.JButton) JSpinner(javax.swing.JSpinner) SpinnerModel(javax.swing.SpinnerModel)

Example 49 with JSpinner

use of javax.swing.JSpinner 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 50 with JSpinner

use of javax.swing.JSpinner in project jgnash by ccavanaugh.

the class BudgetOverviewPanel method initComponents.

private void initComponents() {
    sparkLinePanel = new JPanel();
    FormLayout layout = new FormLayout("d", "d");
    sparkLinePanel.setLayout(layout);
    model = new SpinnerNumberModel();
    model.setValue(LocalDate.now().getYear());
    model.setStepSize(1);
    yearSpinner = new JSpinner(model);
    JSpinner.NumberEditor editor = new JSpinner.NumberEditor(yearSpinner, "####");
    yearSpinner.setEditor(editor);
    yearSpinner.setEnabled(false);
}
Also used : FormLayout(com.jgoodies.forms.layout.FormLayout) SpinnerNumberModel(javax.swing.SpinnerNumberModel) JPanel(javax.swing.JPanel) JSpinner(javax.swing.JSpinner)

Aggregations

JSpinner (javax.swing.JSpinner)50 SpinnerNumberModel (javax.swing.SpinnerNumberModel)38 JLabel (javax.swing.JLabel)33 JPanel (javax.swing.JPanel)27 JCheckBox (javax.swing.JCheckBox)15 ChangeEvent (javax.swing.event.ChangeEvent)15 JButton (javax.swing.JButton)12 JRadioButton (javax.swing.JRadioButton)12 ActionEvent (java.awt.event.ActionEvent)10 JScrollPane (javax.swing.JScrollPane)10 ChangeListener (javax.swing.event.ChangeListener)10 BorderLayout (java.awt.BorderLayout)9 ActionListener (java.awt.event.ActionListener)9 GridBagConstraints (java.awt.GridBagConstraints)7 Insets (java.awt.Insets)7 FormLayout (com.jgoodies.forms.layout.FormLayout)6 JTable (javax.swing.JTable)6 Dimension (java.awt.Dimension)5 GridBagLayout (java.awt.GridBagLayout)5 ItemEvent (java.awt.event.ItemEvent)5