Example usage for javax.swing SpinnerNumberModel setMaximum

List of usage examples for javax.swing SpinnerNumberModel setMaximum

Introduction

In this page you can find the example usage for javax.swing SpinnerNumberModel setMaximum.

Prototype

public void setMaximum(Comparable<?> maximum) 

Source Link

Document

Changes the upper bound for numbers in this sequence.

Usage

From source file:au.org.ala.delta.editor.ui.ItemEditor.java

/**
 * Synchronizes the state of the UI with the currently selected Item.
 *//*from www . j a v  a2  s  .  c o  m*/
private void updateDisplay() {

    _editsDisabled = true;

    if (_selectedItem == null) {
        _selectedItem = _dataSet.getItem(1);
    }

    SpinnerNumberModel model = (SpinnerNumberModel) spinner.getModel();
    model.setMaximum(_dataSet.getMaximumNumberOfItems() + 1);
    model.setValue(_selectedItem.getItemNumber());

    rtfEditor.setText(_selectedItem.getDescription());

    chckbxTreatAsVariant.setSelected(_selectedItem.isVariant());
    imageDetails.bind(_dataSet, _selectedItem);
    rtfEditor.requestFocusInWindow();
    _editsDisabled = false;
}

From source file:ch.epfl.lis.gnwgui.Simulation.java

/**
 * Constructor/*from   www.  j a  v  a2 s .  c  o  m*/
 */
public Simulation(Frame aFrame, NetworkElement item) {

    super(aFrame);
    item_ = item;

    GnwSettings settings = GnwSettings.getInstance();

    // Model
    model_.setModel(new DefaultComboBoxModel(
            new String[] { "Deterministic (ODEs)", "Stochastic (SDEs)", "Run both (ODEs and SDEs)" }));
    if (settings.getSimulateODE() && !settings.getSimulateSDE())
        model_.setSelectedIndex(0);
    else if (!settings.getSimulateODE() && settings.getSimulateSDE())
        model_.setSelectedIndex(1);
    else if (settings.getSimulateODE() && settings.getSimulateSDE())
        model_.setSelectedIndex(2);

    // Experiments
    wtSS_.setSelected(true);
    wtSS_.setEnabled(false);

    knockoutSS_.setSelected(settings.generateSsKnockouts());
    knockdownSS_.setSelected(settings.generateSsKnockdowns());
    multifactorialSS_.setSelected(settings.generateSsMultifactorial());
    dualKnockoutSS_.setSelected(settings.generateSsDualKnockouts());

    knockoutTS_.setSelected(settings.generateTsKnockouts());
    knockdownTS_.setSelected(settings.generateTsKnockdowns());
    multifactorialTS_.setSelected(settings.generateTsMultifactorial());
    dualKnockoutTS_.setSelected(settings.generateTsDualKnockouts());

    timeSeriesAsDream4_.setSelected(settings.generateTsDREAM4TimeSeries());

    // Set model of "number of time series" spinner
    SpinnerNumberModel model = new SpinnerNumberModel();
    model.setMinimum(1);
    model.setMaximum(10000);
    model.setStepSize(1);
    model.setValue(settings.getNumTimeSeries());
    numTimeSeries_.setModel(model);

    // Set model of "duration" spinner
    model = new SpinnerNumberModel();
    model.setMinimum(1);
    model.setMaximum(100000);
    model.setStepSize(10);
    model.setValue((int) settings.getMaxtTimeSeries());
    tmax_.setModel(model);

    // Set model of "number of points per time series" spinner
    model = new SpinnerNumberModel();
    model.setMinimum(3);
    model.setMaximum(100000);
    model.setStepSize(10);

    double dt = settings.getDt();
    double maxt = settings.getMaxtTimeSeries();
    int numMeasuredPoints = (int) Math.round(maxt / dt) + 1;

    if (dt * (numMeasuredPoints - 1) != maxt)
        throw new RuntimeException(
                "Duration of time series (GnwSettings.maxtTimeSeries_) must be a multiple of the time step (GnwSettings.dt_)");

    model.setValue(numMeasuredPoints);
    numPointsPerTimeSeries_.setModel(model);

    perturbationNew_.setSelected(!settings.getLoadPerturbations());
    perturbationLoad_.setSelected(settings.getLoadPerturbations());

    // Noise

    // Diffusion multiplier (SDE only)
    model = new SpinnerNumberModel();
    model.setMinimum(0.0);
    model.setMaximum(10.);
    model.setStepSize(0.01);
    model.setValue(settings.getNoiseCoefficientSDE());
    sdeDiffusionCoeff_.setModel(model);

    noNoise_.setSelected(!settings.getAddMicroarrayNoise() && !settings.getAddNormalNoise()
            && !settings.getAddLognormalNoise());
    useMicroarrayNoise_.setSelected(settings.getAddMicroarrayNoise());
    useLogNormalNoise_.setSelected(settings.getAddNormalNoise() || settings.getAddLognormalNoise());
    addGaussianNoise_.setSelected(settings.getAddNormalNoise());
    addLogNormalNoise_.setSelected(settings.getAddLognormalNoise());

    // Set model of "Gaussian noise std" spinner
    model = new SpinnerNumberModel();
    model.setMinimum(0.000001);
    model.setMaximum(10.);
    model.setStepSize(0.01);
    model.setValue(settings.getNormalStdev());
    gaussianNoise_.setModel(model);

    // Set model of "log-normal noise std" spinner
    model = new SpinnerNumberModel();
    model.setMinimum(0.000001);
    model.setMaximum(10.);
    model.setStepSize(0.01);
    model.setValue(settings.getLognormalStdev());
    logNormalNoise_.setModel(model);

    normalizeNoise_.setSelected(settings.getNormalizeAfterAddingNoise());

    // Set the text field with the user path
    userPath_.setText(GnwSettings.getInstance().getOutputDirectory());

    setModelAction();
    setExperimentAction();
    setNoiseAction();

    String title1, title2;
    title1 = title2 = "";
    if (item_ instanceof StructureElement) {
        ImodNetwork network = ((StructureElement) item_).getNetwork();
        title1 = item_.getLabel();
        title2 = network.getSize() + " nodes, " + network.getNumEdges() + " edges";
    } else if (item_ instanceof DynamicalModelElement) {
        GeneNetwork geneNetwork = ((DynamicalModelElement) item_).getGeneNetwork();
        title1 = item_.getLabel();
        title2 = geneNetwork.getSize() + " genes, " + geneNetwork.getNumEdges() + " interactions";
    }
    setHeaderInfo(title1 + " (" + title2 + ")");

    // Set tool tips for all elements of the window
    addTooltips();

    /**
     * ACTIONS
     */

    model_.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            setModelAction();
        }
    });

    dream4Settings_.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            setDream4Settings();
        }
    });

    browse_.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent arg0) {

            IODialog dialog = new IODialog(new Frame(""), "Select Target Folder",
                    GnwSettings.getInstance().getOutputDirectory(), IODialog.LOAD);

            dialog.selectOnlyFolder(true);
            dialog.display();

            if (dialog.getSelection() != null)
                userPath_.setText(dialog.getSelection());
        }
    });

    runButton_.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent arg0) {
            enterAction();
        }
    });

    cancelButton_.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent arg0) {
            GnwSettings.getInstance().stopBenchmarkGeneration(true);
            escapeAction();
        }
    });

    knockoutSS_.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent arg0) {
            setExperimentAction();
        }
    });

    knockdownSS_.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent arg0) {
            setExperimentAction();
        }
    });

    multifactorialSS_.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent arg0) {
            setExperimentAction();
        }
    });

    dualKnockoutSS_.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent arg0) {
            setExperimentAction();
        }
    });

    knockoutTS_.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent arg0) {
            setExperimentAction();
        }
    });

    knockdownTS_.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent arg0) {
            setExperimentAction();
        }
    });

    multifactorialTS_.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent arg0) {
            setExperimentAction();
        }
    });

    dualKnockoutTS_.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent arg0) {
            setExperimentAction();
        }
    });

    timeSeriesAsDream4_.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent arg0) {
            setExperimentAction();
        }
    });

    noNoise_.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent arg0) {
            setNoiseAction();
        }
    });

    useMicroarrayNoise_.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent arg0) {
            setNoiseAction();
        }
    });

    useLogNormalNoise_.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent arg0) {
            setNoiseAction();
        }
    });

    addGaussianNoise_.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent arg0) {
            setNoiseAction();
        }
    });

    addLogNormalNoise_.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent arg0) {
            setNoiseAction();
        }
    });
}

From source file:com.biosis.biosislite.vistas.AsignarPermiso.java

private void actualizarControlesNavegacion() {
    spPagina.setValue(paginaActual);// w w  w.j ava2  s  .c o m
    txtTotal.setText(totalPaginas + "");

    SpinnerNumberModel modeloSP = (SpinnerNumberModel) spPagina.getModel();
    Comparable<Integer> maximo = totalPaginas;
    modeloSP.setMaximum(maximo);

    this.btnSiguiente.setEnabled(paginaActual != totalPaginas);
    this.btnUltimo.setEnabled(paginaActual != totalPaginas);

    this.btnAnterior.setEnabled(paginaActual != 1);
    this.btnPrimero.setEnabled(paginaActual != 1);
}

From source file:com.xilinx.ultrascale.gui.MainScreen.java

private void maxcoeffStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_maxcoeffStateChanged
    // TODO add your handling code here:
    if (testStarted == true) {
        SpinnerNumberModel sp = (SpinnerNumberModel) mincoeff.getModel();
        sp.setMaximum(Integer.parseInt(maxcoeff.getValue().toString()));
        mincoeff.setModel(sp);// www .  j a v a 2  s. c o  m
        di.startVideoTest(0, 7, Integer.parseInt(mincoeff.getValue().toString()),
                Integer.parseInt(maxcoeff.getValue().toString()), invertcheckbox.isSelected() ? 1 : 0, 7680);
    }
}

From source file:org.yccheok.jstock.gui.NewSellTransactionJDialog.java

private void setMaxSellQuantity(double maxSellQuantity) {
    SpinnerNumberModel spinnerNumberModel = (SpinnerNumberModel) jSpinner1.getModel();
    spinnerNumberModel.setMaximum(maxSellQuantity);
}