Search in sources :

Example 1 with SpinnerModel

use of javax.swing.SpinnerModel in project beast-mcmc by beast-dev.

the class SiteRateModelEditor method setSiteArguments.

// END: Constructor
private void setSiteArguments() throws NumberFormatException, BadLocationException {
    optionPanel.removeAll();
    optionPanel.addComponents(new JLabel("Site Rate model:"), siteCombo);
    optionPanel.addSeparator();
    optionPanel.addLabel("Set parameter values:");
    int index = siteCombo.getSelectedIndex();
    for (int i = 0; i < PartitionData.siteRateModelParameterIndices[index].length; i++) {
        if (index == 1 && i == 0) {
            int k = PartitionData.siteRateModelParameterIndices[index][i];
            Integer initValue = Integer.valueOf(siteParameterFields[k].getText(0, 1));
            Integer min = 1;
            //Integer.MAX_VALUE;
            Integer max = 10;
            Integer step = 1;
            SpinnerModel model = new SpinnerNumberModel(initValue, min, max, step);
            gammaCategoriesSpinner = new JSpinner(model);
            JPanel panel = new JPanel(new BorderLayout(6, 6));
            panel.add(gammaCategoriesSpinner, BorderLayout.WEST);
            panel.setOpaque(false);
            optionPanel.addComponentWithLabel(PartitionData.siteRateModelParameterNames[k] + ":", panel);
        } else {
            int k = PartitionData.siteRateModelParameterIndices[index][i];
            JPanel panel = new JPanel(new BorderLayout(6, 6));
            panel.add(siteParameterFields[k], BorderLayout.WEST);
            panel.setOpaque(false);
            optionPanel.addComponentWithLabel(PartitionData.siteRateModelParameterNames[k] + ":", panel);
        }
    // END: gama categories field check
    }
    // END: indices loop
    window.validate();
    window.repaint();
}
Also used : SpinnerNumberModel(javax.swing.SpinnerNumberModel) JPanel(javax.swing.JPanel) BorderLayout(java.awt.BorderLayout) JLabel(javax.swing.JLabel) JSpinner(javax.swing.JSpinner) SpinnerModel(javax.swing.SpinnerModel)

Example 2 with SpinnerModel

use of javax.swing.SpinnerModel in project sic by belluccifranco.

the class AbrirCajaGUI method setModelSpinner.

private void setModelSpinner() {
    SpinnerModel spinnerModel = new SpinnerNumberModel(Calendar.getInstance().get(Calendar.HOUR_OF_DAY), Calendar.getInstance().get(Calendar.HOUR_OF_DAY), 23, 1);
    this.spinner_Hora.setModel(spinnerModel);
    spinnerModel = new SpinnerNumberModel(Calendar.getInstance().get(Calendar.MINUTE), 00, 59, 1);
    this.spinner_Minutos.setModel(spinnerModel);
}
Also used : SpinnerNumberModel(javax.swing.SpinnerNumberModel) SpinnerModel(javax.swing.SpinnerModel)

Example 3 with SpinnerModel

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

the class StartupOptions method initComponents.

private void initComponents() {
    updateCurrenciesButton = new JCheckBox(rb.getString("Button.UpdateCurrenciesStartup"));
    updateSecuritiesButton = new JCheckBox(rb.getString("Button.UpdateSecuritiesStartup"));
    openLastOnStartup = new JCheckBox(rb.getString("Button.OpenLastOnStartup"));
    removeBackupButton = new JCheckBox(rb.getString("Button.RemoveOldBackups"));
    saveBackupButton = new JCheckBox(rb.getString("Button.CreateTimeFile"));
    removeBackupCountSpinner = new JSpinner(new SpinnerNumberModel(1, 1, 100, 1));
    if (engine != null) {
        saveBackupButton.setSelected(engine.createBackups());
        removeBackupButton.setSelected(engine.removeOldBackups());
        removeBackupCountSpinner.setValue(engine.getRetainedBackupLimit());
    } else {
        saveBackupButton.setEnabled(false);
        removeBackupButton.setEnabled(false);
        removeBackupCountSpinner.setEnabled(false);
    }
    updateCurrenciesButton.setSelected(CurrencyUpdateFactory.getUpdateOnStartup());
    updateSecuritiesButton.setSelected(UpdateFactory.getUpdateOnStartup());
    openLastOnStartup.setSelected(EngineFactory.openLastOnStartup());
    updateCurrenciesButton.addActionListener(this);
    updateSecuritiesButton.addActionListener(this);
    saveBackupButton.addActionListener(this);
    removeBackupButton.addActionListener(this);
    openLastOnStartup.addActionListener(this);
    removeBackupCountSpinner.addChangeListener(e -> {
        SpinnerModel dateModel = removeBackupCountSpinner.getModel();
        if (dateModel instanceof SpinnerNumberModel) {
            final Number count = ((SpinnerNumberModel) dateModel).getNumber();
            if (engine != null) {
                engine.setRetainedBackupLimit((Integer) count);
            }
        }
    });
}
Also used : JCheckBox(javax.swing.JCheckBox) SpinnerNumberModel(javax.swing.SpinnerNumberModel) JSpinner(javax.swing.JSpinner) SpinnerModel(javax.swing.SpinnerModel)

Example 4 with SpinnerModel

use of javax.swing.SpinnerModel 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)

Aggregations

SpinnerModel (javax.swing.SpinnerModel)4 SpinnerNumberModel (javax.swing.SpinnerNumberModel)4 JSpinner (javax.swing.JSpinner)3 JCheckBox (javax.swing.JCheckBox)2 BorderLayout (java.awt.BorderLayout)1 JButton (javax.swing.JButton)1 JLabel (javax.swing.JLabel)1 JPanel (javax.swing.JPanel)1