Java 8 SpinnerNumberModel - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 SpinnerNumberModel class.

This code example shows how to use the following methods:setMaximum, setMinimum, setStepSize, setValue
    panel3 = new JPanel(new FlowLayout());
    panel3.add(new JLabel("max. rows"));
    panel3.add(m_SpinnerMaxRows);
    panel2.add(panel3, BorderLayout.SOUTH);
    model = (SpinnerNumberModel) m_SpinnerMaxRows.getModel();
    model.setMaximum(new Integer(Integer.MAX_VALUE));
    model.setMinimum(new Integer(0));
    model.setValue(new Integer(100));
    model.setStepSize(new Integer(100));
    m_SpinnerMaxRows.setMinimumSize(
        new Dimension(50, m_SpinnerMaxRows.getHeight()));
    m_SpinnerMaxRows.setToolTipText("with 0 all rows are retrieved");
       
    // set initial state 
    setButtons(); 
  } 
 
  /** 
   * sets the focus in a designated control. 
   */ 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
/** @author Inferno */ 
public class Slider extends JPanel {
	public JSpinner spinner;
 
	public Slider (float initialValue, final float min, final float max, float stepSize) {
		spinner = new JSpinner(new SpinnerNumberModel(initialValue, min, max, stepSize));
		setLayout(new BorderLayout());
		add(spinner);
	} 
 
	public void setValue (float value) {
		spinner.setValue((double)value);
	} 
 
	public float getValue () { 
		return ((Double)spinner.getValue()).floatValue();
	} 
 
	public void addChangeListener (ChangeListener listener) {
		spinner.addChangeListener(listener);
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
class Slider extends JPanel {
	private JSpinner spinner;
 
	public Slider (float initialValue, final float min, final float max, float stepSize, final float sliderMin,
		final float sliderMax) {
		spinner = new JSpinner(new SpinnerNumberModel(initialValue, min, max, stepSize));
		setLayout(new BorderLayout());
		add(spinner);
	} 
 
	public void setValue (float value) {
		spinner.setValue((double)value);
	} 
 
	public float getValue () { 
		return ((Double)spinner.getValue()).floatValue();
	} 
 
	public void addChangeListener (ChangeListener listener) {
		spinner.addChangeListener(listener);
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:setMaximum, setMinimum, setStepSize, setValue
 */ 
public class NumberSpinnerSettingType implements UploaderSettingType { 
 
	@Override 
	public JComponent constructComponent(String[] defaults) {
		SpinnerNumberModel model = new SpinnerNumberModel();
		Map<String, String> m = Util.parseDataList(defaults);
		if(m.containsKey("default")) {
			model.setValue(Integer.parseInt(m.get("default")));
		} 
		if(m.containsKey("min")) {
			model.setMinimum(Integer.parseInt(m.get("min")));
		} 
		if(m.containsKey("max")) {
			model.setMaximum(Integer.parseInt(m.get("max")));
		} 
		if(m.containsKey("step")) {
			model.setStepSize(Integer.parseInt(m.get("step")));
		} 
		return new JSpinner(model);

5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:setMaximum, setMinimum
    { 
        // Create the content controls 
        final JLabel quantityLabel = new JLabel(I18N
            .getString("dialog.changeQuantity.quantity")); 
        this.quantitySpinner = new JSpinner();
        final SpinnerNumberModel model = new SpinnerNumberModel();
        model.setMinimum(0);
        model.setMaximum(999);
        this.quantitySpinner.setModel(model);
        SwingUtils.installSpinnerBugWorkaround(this.quantitySpinner);
        quantityLabel.setLabelFor(this.quantitySpinner);
 
        // Create the content panel 
        final JPanel contentPanel = new JPanel();
        contentPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
        contentPanel.setLayout(new BoxLayout(contentPanel, BoxLayout.X_AXIS));
        contentPanel.add(quantityLabel);
        contentPanel.add(Box.createRigidArea(new Dimension(10, 0)));
        contentPanel.add(this.quantitySpinner);
 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:setValue
 * @summary Events forwarded from previous model 
 */ 
public class bug6463712 implements ChangeListener {
 
    public bug6463712() { 
        SpinnerNumberModel m1 = new SpinnerNumberModel();
        JSpinner s = new JSpinner(m1);
        s.addChangeListener(this);
        SpinnerDateModel m2 = new SpinnerDateModel();
        s.setModel(m2);
 
        // m1 is no longer linked to the JSpinner (it has been replaced by m2), so 
        // the following should not trigger a call to our stateChanged() method... 
        m1.setValue(new Integer(1));
    } 
 
    public void stateChanged(ChangeEvent e) {
        throw new RuntimeException("Should not receive this event.");
    } 
 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
        elitismLabel.setLabelFor(elitismSpinner);
        innerPanel.add(elitismLabel);
        innerPanel.add(elitismSpinner);
 
        generationsLabel = new JLabel("Number of Generations: ");
        generationsSpinner = new JSpinner(new SpinnerNumberModel(100, 1, 10000, 1));
        generationsLabel.setLabelFor(generationsSpinner);
        innerPanel.add(generationsLabel);
        innerPanel.add(generationsSpinner);
 
        selectionLabel = new JLabel("Selection Strategy: ");
        List<SelectionStrategy<? super List<String>>> strategies
            = SelectionStrategyControl.createDefaultOptions(new Probability(0.95d), 0.5d); 
        this.selectionControl = new SelectionStrategyControl<List<String>>(strategies);
        innerPanel.add(selectionLabel);
        selectionControl.getControl().setSelectedIndex(selectionControl.getControl().getItemCount() - 1);
        innerPanel.add(selectionControl.getControl());
 
        crossoverCheckbox = new JCheckBox("Cross-over", true);
        mutationCheckbox = new JCheckBox("Mutation", true);
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
        panel.addMouseListener(this);
        return panel;
    } 
 
    private JPanel getNonLandAnimationPanel() {
        nonLandAnimationSpinner = new JSpinner(new SpinnerNumberModel(config.getNonLandPreviewDuration(), 1000, 20000, 100));
        // allow only numeric characters to be recognised. 
        nonLandAnimationSpinner.setEditor(new JSpinner.NumberEditor(nonLandAnimationSpinner,"#"));
        final JFormattedTextField txt1 = ((JSpinner.NumberEditor) nonLandAnimationSpinner.getEditor()).getTextField();
        ((NumberFormatter)txt1.getFormatter()).setAllowsInvalid(false);
        // 
        final JPanel panel = new JPanel(new MigLayout("insets 0"));
        panel.add(new JLabel("Display non-land card for"));
        panel.add(nonLandAnimationSpinner, "w 70!");
        panel.add(new JLabel("msecs"));
        panel.setToolTipText("When the AI plays a non-land card, this setting determines how long it should be displayed at full size (1000 millisecs = 1 second).");
        panel.addMouseListener(this);
        return panel;
    } 
 
2
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
This code example shows how to use the following methods:
		this.archive = archive;
		this.mainActivity = mainActivity;
		setLayout(new BorderLayout());
		query = new JTextField();
		query.setToolTipText(Messages.getString("SearchView.3")); //$NON-NLS-1$
		page = new JSpinner(new SpinnerNumberModel(1, 1, 10000, 1));
		page.setToolTipText(Messages.getString("SearchView.4")); //$NON-NLS-1$
		results = new JScrollPane();
		cardLayout = new CardLayout();
 
		message = new HypertextPane(""); //$NON-NLS-1$
		message.setMargin(new Insets(10, 10, 10, 10));
		progress = new JProgressBar();
		progress.setIndeterminate(true);
		progress.setString(Messages.getString("SearchView.5")); //$NON-NLS-1$
		progress.setStringPainted(true);
		cancel = new JButton(Messages.getString("SearchView.0")); //$NON-NLS-1$
 
		GridBagConstraints center = new GridBagConstraints();
		center.anchor = GridBagConstraints.CENTER;
3
CodeRank
Experience pair programming with AI  Get Codota for Java
See Code Examples for Java 8 SpinnerNumberModel Methods: