Here you can find the source of getSpinnerIntValue(JSpinner spin)
Parameter | Description |
---|---|
spin | JSpinner |
public static int getSpinnerIntValue(JSpinner spin)
//package com.java2s; //License from project: Open Source License import javax.swing.JSpinner; public class Main { /**// w w w . ja v a2 s . c o m * Evaluates the numeric int value of a spinner object * * @param spin * JSpinner * @return int value of the spinner value */ public static int getSpinnerIntValue(JSpinner spin) { return getSpinnerDoubleValue(spin).intValue(); } /** * Evaluates the numeric double value of a spinner object * * @param spin * JSpinner * @return double value of the spinner value */ public static Double getSpinnerDoubleValue(JSpinner spin) { Double d = 0.0; int i = 0; if (spin.getValue().getClass() == Double.class || spin.getValue().getClass() == double.class) { d = (double) spin.getValue(); } if (spin.getValue().getClass() == Integer.class || spin.getValue().getClass() == int.class) { i = (Integer) spin.getValue(); d = (double) i; } return d; } }