User:Zolta/answering newbie questions from nbusers mailing list


The JSpinner class's model defaults to SpinnerModel with Integer value

     * Constructs a <code>SpinnerNumberModel</code> with no
     * <code>minimum</code> or <code>maximum</code> value, 
     * <code>stepSize</code> equal to one, and an initial value of zero.
    public SpinnerNumberModel() {
          this(new Integer(0), null, null, new Integer(1));

If you'd like to use a double value you need to create your JSpinner with the constructor

   public SpinnerNumberModel(double value, double minimum, double maximum, double stepSize) {

such as

JSpinner someJSpinner = new JSpinner(new SpinnerNumberModel(5.0,0.0,10.0,.5));


--Zolta 16:37, 15 December 2009 (UTC)

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo