Example usage for javax.swing SpinnerNumberModel setMinimum

List of usage examples for javax.swing SpinnerNumberModel setMinimum

Introduction

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

Prototype

public void setMinimum(Comparable<?> minimum) 

Source Link

Document

Changes the lower bound for numbers in this sequence.

Usage

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

/**
 * Constructor//from   ww  w  . ja  v  a 2 s .  com
 */
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:Tcpbw100.java

public void init() {

    //added applet parameters (country,language) to directly influence the language displayed
    if (getParameter("country") != null)
        country = getParameter("country");
    if (getParameter("language") != null)
        lang = getParameter("language");
    if (getParameter("client") != null)
        applet_id = getParameter("client");
    // try to load the appropriate resource files
    try {/*from   w  ww. j av a2s. com*/
        locale = new Locale(lang, country);
        System.out.println("Interface language set to " + locale.getLanguage() + "_" + locale.getCountry());
        messages = ResourceBundle.getBundle("Tcpbw100_msgs", locale);
        res = ResourceBundle.getBundle("strings", locale);
        System.out.println("language loaded is :" + res.getLocale());
    } catch (Exception e) {
        JOptionPane.showMessageDialog(null, "Error while loading language files:\n" + e.getMessage());
        e.printStackTrace();
    }

    JPanel advancedPanel = new JPanel(new BorderLayout());
    final CardLayout cards = new CardLayout();
    getContentPane().setLayout(cards);

    final JFrame popout = new JFrame("Network Diagnostic Tool");
    popout.add(advancedPanel);
    popout.pack();

    //blank the labels
    reset_labels();

    showStatus(messages.getString("ready"));
    failed = false;
    Randomize = false;
    cancopy = false;
    results = new MyTextPane();
    results.append("TCP/Web100 Network Diagnostic Tool v" + VERSION + "\n");
    results.setEditable(false);
    advancedPanel.add(new JScrollPane(results), BorderLayout.CENTER);
    results.append(messages.getString("clickStart") + "\n");
    Panel mPanel = new Panel();
    startTest = new JButton(messages.getString("start"));
    startTest.addActionListener(this);
    startTest2 = new JButton(res.getString("start"));
    startTest2.addActionListener(this);

    //mPanel.add(startTest);
    sTatistics = new JButton(messages.getString("statistics"));
    sTatistics.addActionListener(this);
    if (getParameter("disableStatistics") == null) {
        mPanel.add(sTatistics);
    }
    sTatistics.setEnabled(false);
    deTails = new JButton(messages.getString("moreDetails"));
    deTails.addActionListener(this);
    if (getParameter("disableDetails") == null) {
        mPanel.add(deTails);
    }
    deTails.setEnabled(false);
    mailTo = new JButton(messages.getString("reportProblem"));
    mailTo.addActionListener(this);
    if (getParameter("disableMailto") == null) {
        //mPanel.add(mailTo);
    }
    mailTo.setEnabled(false);
    options = new JButton(messages.getString("options") + "...");
    options.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            options.setEnabled(false);
            showOptions();
            options.setEnabled(true);
        }

    });
    if (getParameter("disableOptions") == null) {
        mPanel.add(options);
    }
    advancedPanel.add(mPanel, BorderLayout.SOUTH);
    preferIPv6 = new JCheckBox(messages.getString("preferIPv6"));
    preferIPv6.setSelected(true);
    defaultTest = new JCheckBox(messages.getString("defaultTests"));
    defaultTest.setSelected(true);
    defaultTest.setEnabled(false);
    SpinnerNumberModel model = new SpinnerNumberModel();
    model.setMinimum(new Integer(0));
    model.setValue(new Integer(1));
    numOfTests.setModel(model);
    numOfTests.setPreferredSize(new Dimension(60, 20));
    delay = new JComboBox();
    for (int i = 0; i < delays.length; i++) {
        delay.addItem(messages.getString(delays[i]));
    }
    delay.setSelectedIndex(0);

    //Autorun functionality
    isAutoRun = getParameter("autoRun");
    if ((isAutoRun != null) && isAutoRun.equals("true")) {
        pub_errmsg = "Test in progress.";
        runtest();
    }
    //@@@ getContentPane().add(advancedPanel,"");

    //try to load the calibri font for the simplified interface.
    //this will not cause problems even if said font is not available
    Font very_small_font = new Font("Calibri", Font.PLAIN, 6);
    Font small_font = new Font("Calibri", Font.PLAIN, 14);
    Font big_font = new Font("Calibri", Font.PLAIN, 18);

    startTest2.setFont(small_font);

    //simplePanel will be the new face of the applet
    JPanel simplePanel = new JPanel();

    simplePanel.setLayout(null);
    simplePanel.setBackground(Color.WHITE);
    //simplePanel.setLayout(new BorderLayout());
    simplePanel.add(simple_progressBar, BorderLayout.SOUTH);
    getContentPane().add(simplePanel, "");
    cards.last(getContentPane());
    simple_progressBar.setMaximum(10);
    simple_progressBar.setBounds(3, 135, 394, 23);
    simple_progressBar.setFont(small_font);

    //simple_progressBar.setIndeterminate(true);
    simple_progressBar.setIndeterminate(false);
    simple_progressBar.setValue(0);
    simple_progressBar.setStringPainted(true);
    simple_progressBar.setString(res.getString("ready_to_measure"));

    //position the startTest2 button explicitly
    //was: simplePanel.add(startTest2,BorderLayout.NORTH);
    simplePanel.add(startTest2, "");
    startTest2.setBounds(3, 164, 195, 30);

    final class switcherListener implements ActionListener {
        public void actionPerformed(ActionEvent e) {
            //@@@cards.next(getContentPane());
            if (popout.isVisible()) {
                popout.setVisible(false);
            } else {
                popout.setVisible(true);
                popout.pack();
            }

        }

    }

    //"show details button" - activates the classic NDT interface 
    JButton switchPane = new JButton(res.getString("show_details"));
    switchPane.setFont(small_font);

    switchPane.addActionListener(new switcherListener());
    simplePanel.add(switchPane, "");
    switchPane.setBounds(202, 164, 195, 30);

    //masterArea, displays the measurement characteristics
    JPanel masterArea = new JPanel(new GridLayout(0, 2));

    //position explicitly
    simplePanel.add(masterArea, "");
    masterArea.setBounds(1, 1, 398, 130);
    masterArea.setBackground(Color.WHITE);

    //create the 5 tags that will be placed in the masterArea
    JLabel dnlTag = new JLabel(res.getString("download"));
    JLabel uplTag = new JLabel(res.getString("upload"));
    JLabel rttTag = new JLabel(res.getString("ping"));
    JLabel lossTag = new JLabel(res.getString("loss"));
    JLabel jitterTag = new JLabel(res.getString("jitter"));

    //make the masterAre pretty  
    dnlTag.setHorizontalAlignment(JLabel.RIGHT);
    uplTag.setHorizontalAlignment(JLabel.RIGHT);
    rttTag.setHorizontalAlignment(JLabel.RIGHT);
    lossTag.setHorizontalAlignment(JLabel.RIGHT);
    jitterTag.setHorizontalAlignment(JLabel.RIGHT);

    dnlTag.setFont(big_font);
    uplTag.setFont(big_font);
    rttTag.setFont(big_font);
    lossTag.setFont(big_font);
    jitterTag.setFont(big_font);

    dnlLbl.setHorizontalAlignment(JLabel.LEFT);
    uplLbl.setHorizontalAlignment(JLabel.LEFT);
    rttLbl.setHorizontalAlignment(JLabel.LEFT);
    lossLbl.setHorizontalAlignment(JLabel.LEFT);
    jitterLbl.setHorizontalAlignment(JLabel.LEFT);

    dnlLbl.setFont(big_font);
    uplLbl.setFont(big_font);
    rttLbl.setFont(big_font);
    lossLbl.setFont(big_font);
    jitterLbl.setFont(big_font);

    //and finally, place the labels
    masterArea.add(dnlTag);
    masterArea.add(dnlLbl);
    masterArea.add(uplTag);
    masterArea.add(uplLbl);
    masterArea.add(rttTag);
    masterArea.add(rttLbl);
    masterArea.add(lossTag);
    masterArea.add(lossLbl);
    masterArea.add(jitterTag);
    masterArea.add(jitterLbl);

    // determine whether to prefer IPv6 or not, this is done only once
    if (getParameter("disable_ipv6") != null) {
        preferIPv6.setSelected(false);
    }

}

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

private void mincoeffStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_mincoeffStateChanged
    // TODO add your handling code here:
    if (testStarted == true) {
        SpinnerNumberModel sp = (SpinnerNumberModel) maxcoeff.getModel();
        sp.setMinimum(Integer.parseInt(mincoeff.getValue().toString()));

        maxcoeff.setModel(sp);// w ww.java 2s .  c  om
        di.startVideoTest(0, 7, Integer.parseInt(mincoeff.getValue().toString()),
                Integer.parseInt(maxcoeff.getValue().toString()), invertcheckbox.isSelected() ? 1 : 0, 7680);
    }
}