Search in sources :

Example 56 with JSpinner

use of javax.swing.JSpinner in project JMRI by JMRI.

the class DieselPane method initComponents.

/**
     * Build teh GUI components
     */
@Override
public void initComponents() {
    listenerList = new javax.swing.event.EventListenerList();
    this.setLayout(new GridLayout(0, 2));
    //Set up the throttle spinner
    throttle_spinner = new JSpinner(new SpinnerNumberModel(THROTTLE_INIT, THROTTLE_MIN, THROTTLE_MAX, 1));
    throttle_spinner.setToolTipText(Bundle.getMessage("ToolTipDP_ThrottleSpinner"));
    throttle_spinner.setEnabled(false);
    this.add(throttle_spinner);
    // Setup the start button
    start_button = new JToggleButton();
    start_button.setText(Bundle.getMessage("ButtonEngineStart"));
    start_button.setToolTipText(Bundle.getMessage("ToolTipDP_StartButton"));
    start_button.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            startButtonChange(e);
        }
    });
    this.add(start_button);
    this.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    this.setVisible(true);
}
Also used : SpinnerNumberModel(javax.swing.SpinnerNumberModel) GridLayout(java.awt.GridLayout) JToggleButton(javax.swing.JToggleButton) ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) JSpinner(javax.swing.JSpinner)

Example 57 with JSpinner

use of javax.swing.JSpinner in project JMRI by JMRI.

the class ProfilePreferencesPanel method initComponents.

/**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
@SuppressWarnings("unchecked")
private // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
void initComponents() {
    profilesPopupMenu = new JPopupMenu();
    renameMI = new JMenuItem();
    jSeparator1 = new JPopupMenu.Separator();
    copyMI = new JMenuItem();
    deleteMI = new JMenuItem();
    grpStartWithSelectors = new ButtonGroup();
    jTabbedPane1 = new JTabbedPane();
    enabledPanel = new JPanel();
    jScrollPane1 = new JScrollPane();
    profilesTbl = new JTable() {

        //Implement table cell tool tips.
        public String getToolTipText(MouseEvent e) {
            try {
                return getValueAt(rowAtPoint(e.getPoint()), -1).toString();
            } catch (RuntimeException e1) {
            //catch null pointer exception if mouse is over an empty line
            }
            return null;
        }
    };
    btnOpenExistingProfile = new JButton();
    btnDeleteProfile = new JButton();
    btnCreateNewProfile = new JButton();
    btnActivateProfile = new JButton();
    btnExportProfile = new JButton();
    btnCopyProfile = new JButton();
    spinnerTimeout = new JSpinner();
    jLabel1 = new JLabel();
    rdoStartWithActiveProfile = new JRadioButton();
    rdoStartWithProfileSelector = new JRadioButton();
    searchPathsPanel = new JPanel();
    btnRemoveSearchPath = new JButton();
    btnAddSearchPath = new JButton();
    jScrollPane3 = new JScrollPane();
    searchPathsTbl = new JTable() {

        //Implement table cell tool tips.
        public String getToolTipText(MouseEvent e) {
            try {
                return getValueAt(rowAtPoint(e.getPoint()), -1).toString();
            } catch (RuntimeException e1) {
            //catch null pointer exception if mouse is over an empty line
            }
            return null;
        }
    };
    profilesPopupMenu.addPopupMenuListener(new PopupMenuListener() {

        public void popupMenuWillBecomeVisible(PopupMenuEvent evt) {
            profilesPopupMenuPopupMenuWillBecomeVisible(evt);
        }

        public void popupMenuWillBecomeInvisible(PopupMenuEvent evt) {
        }

        public void popupMenuCanceled(PopupMenuEvent evt) {
        }
    });
    // NOI18N
    ResourceBundle bundle = ResourceBundle.getBundle("jmri/profile/Bundle");
    // NOI18N
    renameMI.setText(bundle.getString("ProfilePreferencesPanel.renameMI.text"));
    renameMI.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent evt) {
            renameMIActionPerformed(evt);
        }
    });
    profilesPopupMenu.add(renameMI);
    profilesPopupMenu.add(jSeparator1);
    // NOI18N
    copyMI.setText(bundle.getString("ProfilePreferencesPanel.copyMI.text"));
    profilesPopupMenu.add(copyMI);
    // NOI18N
    deleteMI.setText(bundle.getString("ProfilePreferencesPanel.deleteMI.text"));
    profilesPopupMenu.add(deleteMI);
    if (ProfileManager.getDefault().isAutoStartActiveProfile()) {
        this.rdoStartWithActiveProfile.setSelected(true);
    } else {
        this.rdoStartWithProfileSelector.setSelected(true);
    }
    profilesTbl.setModel(new ProfileTableModel());
    profilesTbl.getSelectionModel().addListSelectionListener(new ProfilesSelectionListener());
    profilesTbl.getTableHeader().setReorderingAllowed(false);
    jScrollPane1.setViewportView(profilesTbl);
    // NOI18N
    btnOpenExistingProfile.setText(bundle.getString("ProfilePreferencesPanel.btnOpenExistingProfile.text"));
    // NOI18N
    btnOpenExistingProfile.setToolTipText(bundle.getString("ProfilePreferencesPanel.btnOpenExistingProfile.toolTipText"));
    btnOpenExistingProfile.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent evt) {
            btnOpenExistingProfileActionPerformed(evt);
        }
    });
    // NOI18N
    btnDeleteProfile.setText(bundle.getString("ProfilePreferencesPanel.btnDeleteProfile.text"));
    // NOI18N
    btnDeleteProfile.setToolTipText(bundle.getString("ProfilePreferencesPanel.btnDeleteProfile.toolTipText"));
    btnDeleteProfile.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent evt) {
            btnDeleteProfileActionPerformed(evt);
        }
    });
    // NOI18N
    btnCreateNewProfile.setText(bundle.getString("ProfilePreferencesPanel.btnCreateNewProfile.text"));
    // NOI18N
    btnCreateNewProfile.setToolTipText(bundle.getString("ProfilePreferencesPanel.btnCreateNewProfile.toolTipText"));
    btnCreateNewProfile.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent evt) {
            btnCreateNewProfileActionPerformed(evt);
        }
    });
    // NOI18N
    btnActivateProfile.setText(bundle.getString("ProfilePreferencesPanel.btnActivateProfile.text"));
    // NOI18N
    btnActivateProfile.setToolTipText(bundle.getString("ProfilePreferencesPanel.btnActivateProfile.toolTipText"));
    btnActivateProfile.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent evt) {
            btnActivateProfileActionPerformed(evt);
        }
    });
    // NOI18N
    btnExportProfile.setText(bundle.getString("ProfilePreferencesPanel.btnExportProfile.text"));
    // NOI18N
    btnExportProfile.setToolTipText(bundle.getString("ProfilePreferencesPanel.btnExportProfile.toolTipText"));
    btnExportProfile.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent evt) {
            btnExportProfileActionPerformed(evt);
        }
    });
    // NOI18N
    btnCopyProfile.setText(bundle.getString("ProfilePreferencesPanel.btnCopyProfile.text"));
    btnCopyProfile.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent evt) {
            btnCopyProfileActionPerformed(evt);
        }
    });
    spinnerTimeout.setModel(new SpinnerNumberModel(10, 0, 500, 1));
    spinnerTimeout.addChangeListener(new ChangeListener() {

        public void stateChanged(ChangeEvent evt) {
            spinnerTimeoutStateChanged(evt);
        }
    });
    // NOI18N
    jLabel1.setText(bundle.getString("ProfilePreferencesPanel.jLabel1.text"));
    grpStartWithSelectors.add(rdoStartWithActiveProfile);
    // NOI18N
    rdoStartWithActiveProfile.setText(bundle.getString("ProfilePreferencesPanel.rdoStartWithActiveProfile.text"));
    rdoStartWithActiveProfile.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent evt) {
            rdoStartWithActiveProfileActionPerformed(evt);
        }
    });
    grpStartWithSelectors.add(rdoStartWithProfileSelector);
    // NOI18N
    rdoStartWithProfileSelector.setText(bundle.getString("ProfilePreferencesPanel.rdoStartWithProfileSelector.text"));
    rdoStartWithProfileSelector.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent evt) {
            rdoStartWithProfileSelectorActionPerformed(evt);
        }
    });
    GroupLayout enabledPanelLayout = new GroupLayout(enabledPanel);
    enabledPanel.setLayout(enabledPanelLayout);
    enabledPanelLayout.setHorizontalGroup(enabledPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(enabledPanelLayout.createSequentialGroup().addContainerGap().addGroup(enabledPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(jScrollPane1).addGroup(enabledPanelLayout.createSequentialGroup().addComponent(btnActivateProfile).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(btnOpenExistingProfile).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(btnCreateNewProfile).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(btnCopyProfile).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(btnExportProfile).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 60, Short.MAX_VALUE).addComponent(btnDeleteProfile)).addGroup(enabledPanelLayout.createSequentialGroup().addGroup(enabledPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(rdoStartWithActiveProfile).addGroup(enabledPanelLayout.createSequentialGroup().addComponent(rdoStartWithProfileSelector).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(spinnerTimeout, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(jLabel1))).addGap(0, 0, Short.MAX_VALUE))).addContainerGap()));
    enabledPanelLayout.setVerticalGroup(enabledPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(enabledPanelLayout.createSequentialGroup().addContainerGap().addComponent(jScrollPane1, GroupLayout.DEFAULT_SIZE, 190, Short.MAX_VALUE).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addGroup(enabledPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(btnOpenExistingProfile).addComponent(btnCreateNewProfile).addComponent(btnActivateProfile).addComponent(btnExportProfile).addComponent(btnDeleteProfile).addComponent(btnCopyProfile)).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(rdoStartWithActiveProfile).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addGroup(enabledPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(rdoStartWithProfileSelector).addComponent(spinnerTimeout, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addComponent(jLabel1))));
    // NOI18N
    jTabbedPane1.addTab(bundle.getString("ProfilePreferencesPanel.enabledPanel.TabConstraints.tabTitle"), enabledPanel);
    // NOI18N
    btnRemoveSearchPath.setText(bundle.getString("ProfilePreferencesPanel.btnRemoveSearchPath.text"));
    // NOI18N
    btnRemoveSearchPath.setToolTipText(bundle.getString("ProfilePreferencesPanel.btnRemoveSearchPath.toolTipText"));
    btnRemoveSearchPath.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent evt) {
            btnRemoveSearchPathActionPerformed(evt);
        }
    });
    // NOI18N
    btnAddSearchPath.setText(bundle.getString("ProfilePreferencesPanel.btnAddSearchPath.text"));
    // NOI18N
    btnAddSearchPath.setToolTipText(bundle.getString("ProfilePreferencesPanel.btnAddSearchPath.toolTipText"));
    btnAddSearchPath.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent evt) {
            btnAddSearchPathActionPerformed(evt);
        }
    });
    searchPathsTbl.setModel(new SearchPathTableModel());
    searchPathsTbl.getSelectionModel().addListSelectionListener(new SearchPathSelectionListener());
    searchPathsTbl.getTableHeader().setReorderingAllowed(false);
    jScrollPane3.setViewportView(searchPathsTbl);
    GroupLayout searchPathsPanelLayout = new GroupLayout(searchPathsPanel);
    searchPathsPanel.setLayout(searchPathsPanelLayout);
    searchPathsPanelLayout.setHorizontalGroup(searchPathsPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(searchPathsPanelLayout.createSequentialGroup().addContainerGap().addGroup(searchPathsPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(jScrollPane3, GroupLayout.DEFAULT_SIZE, 667, Short.MAX_VALUE).addGroup(searchPathsPanelLayout.createSequentialGroup().addComponent(btnAddSearchPath).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addComponent(btnRemoveSearchPath))).addContainerGap()));
    searchPathsPanelLayout.setVerticalGroup(searchPathsPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(searchPathsPanelLayout.createSequentialGroup().addContainerGap().addComponent(jScrollPane3, GroupLayout.DEFAULT_SIZE, 247, Short.MAX_VALUE).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addGroup(searchPathsPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(btnAddSearchPath).addComponent(btnRemoveSearchPath)).addContainerGap()));
    // NOI18N
    jTabbedPane1.addTab(bundle.getString("ProfilePreferencesPanel.searchPathsPanel.TabConstraints.tabTitle_1"), searchPathsPanel);
    GroupLayout layout = new GroupLayout(this);
    this.setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(jTabbedPane1, GroupLayout.Alignment.TRAILING));
    layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(jTabbedPane1));
    // NOI18N
    jTabbedPane1.getAccessibleContext().setAccessibleName(bundle.getString("ProfilePreferencesPanel.enabledPanel.TabConstraints.tabTitle"));
}
Also used : JPanel(javax.swing.JPanel) JRadioButton(javax.swing.JRadioButton) ActionEvent(java.awt.event.ActionEvent) JTabbedPane(javax.swing.JTabbedPane) PopupMenuListener(javax.swing.event.PopupMenuListener) JButton(javax.swing.JButton) PopupMenuEvent(javax.swing.event.PopupMenuEvent) SpinnerNumberModel(javax.swing.SpinnerNumberModel) GroupLayout(javax.swing.GroupLayout) ChangeListener(javax.swing.event.ChangeListener) PropertyChangeListener(java.beans.PropertyChangeListener) JMenuItem(javax.swing.JMenuItem) JScrollPane(javax.swing.JScrollPane) MouseEvent(java.awt.event.MouseEvent) JLabel(javax.swing.JLabel) JPopupMenu(javax.swing.JPopupMenu) ActionListener(java.awt.event.ActionListener) ChangeEvent(javax.swing.event.ChangeEvent) ButtonGroup(javax.swing.ButtonGroup) JTable(javax.swing.JTable) JSpinner(javax.swing.JSpinner) ResourceBundle(java.util.ResourceBundle)

Example 58 with JSpinner

use of javax.swing.JSpinner in project pcgen by PCGen.

the class AddDefeatedCombatant method getCenter.

//GEN-LAST:event_bSaveActionPerformed
/**
	 *  This method is called from within the constructor to initialize the form.
	 */
@Override
protected JComponent getCenter() {
    JPanel panel = new JPanel();
    java.awt.GridBagConstraints gridBagConstraints;
    lName = new javax.swing.JLabel();
    tName = new javax.swing.JTextField();
    lNumber = new javax.swing.JLabel();
    sNumber = new SpinnerNumberModel(1, 1, 20, 1);
    tNumber = new JSpinner(sNumber);
    lCR = new javax.swing.JLabel();
    lCR2 = new javax.swing.JLabel();
    tCR = new javax.swing.JTextField();
    panel.setLayout(new java.awt.GridBagLayout());
    addWindowListener(new java.awt.event.WindowAdapter() {

        @Override
        public void windowClosing(java.awt.event.WindowEvent evt) {
            close();
        }
    });
    lCR.setText("CR: ");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START;
    gridBagConstraints.insets = new Insets(GAP, GAP, 0, 0);
    panel.add(lCR, gridBagConstraints);
    lNumber.setText("Number: ");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START;
    gridBagConstraints.insets = new Insets(GAP, GAP, 0, 0);
    panel.add(lNumber, gridBagConstraints);
    lName.setText("Name: ");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 3;
    gridBagConstraints.insets = new Insets(GAP, GAP, 0, 0);
    gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START;
    panel.add(lName, gridBagConstraints);
    lCR2.setText("(Note, use decimal fractions for CR. Ex: .5 = 1/2)");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.gridwidth = 2;
    gridBagConstraints.insets = new Insets(0, GAP, 0, GAP);
    gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START;
    panel.add(lCR2, gridBagConstraints);
    // TODO tCR should be internationalized
    tCR.setText("1.0");
    tCR.addActionListener(this::tCRActionPerformed);
    tCR.addFocusListener(new java.awt.event.FocusAdapter() {

        @Override
        public void focusLost(java.awt.event.FocusEvent evt) {
            tCRFocusLost(evt);
        }
    });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 0;
    tCR.setColumns(5);
    gridBagConstraints.insets = new Insets(GAP, 0, 0, GAP);
    gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START;
    panel.add(tCR, gridBagConstraints);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.insets = new Insets(GAP, 0, 0, GAP);
    gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START;
    panel.add(tNumber, gridBagConstraints);
    tName.setColumns(20);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 3;
    gridBagConstraints.gridwidth = 2;
    gridBagConstraints.insets = new Insets(GAP, 0, 0, GAP);
    gridBagConstraints.weightx = 1;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START;
    panel.add(tName, gridBagConstraints);
    return panel;
}
Also used : JPanel(javax.swing.JPanel) Insets(java.awt.Insets) SpinnerNumberModel(javax.swing.SpinnerNumberModel) JLabel(javax.swing.JLabel) JSpinner(javax.swing.JSpinner)

Example 59 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 60 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)76 SpinnerNumberModel (javax.swing.SpinnerNumberModel)61 JLabel (javax.swing.JLabel)47 JPanel (javax.swing.JPanel)41 ActionEvent (java.awt.event.ActionEvent)28 ActionListener (java.awt.event.ActionListener)27 JCheckBox (javax.swing.JCheckBox)22 JRadioButton (javax.swing.JRadioButton)21 GridBagConstraints (java.awt.GridBagConstraints)18 Insets (java.awt.Insets)18 ChangeEvent (javax.swing.event.ChangeEvent)18 GridBagLayout (java.awt.GridBagLayout)17 JButton (javax.swing.JButton)15 Dimension (java.awt.Dimension)13 ChangeListener (javax.swing.event.ChangeListener)13 ButtonGroup (javax.swing.ButtonGroup)12 BorderLayout (java.awt.BorderLayout)11 JTextField (javax.swing.JTextField)11 JScrollPane (javax.swing.JScrollPane)10 JMenuItem (javax.swing.JMenuItem)8