Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package javax.swing;
import java.util.*;
import java.io.Serializable;
/**
* A SpinnerModel for sequences of numbers.
* The upper and lower bounds of the sequence are defined
* by properties called minimum and
* maximum. The size of the increase or decrease
* computed by the nextValue and
* previousValue methods is defined by a property called
* stepSize. The minimum and
* maximum properties can be null
* to indicate that the sequence has no lower or upper limit.
* All of the properties in this class are defined in terms of two
* generic types: Number and
* Comparable, so that all Java numeric types
* may be accommodated. Internally, there's only support for
* values whose type is one of the primitive Number types:
* Double, Float, Long,
* Integer, Short, or Byte.
*
* To create a SpinnerNumberModel for the integer
* range zero to one hundred, with
* fifty as the initial value, one could write:
*
* Integer value = Integer.valueOf(50);
* Integer min = Integer.valueOf(0);
* Integer max = Integer.valueOf(100);
* Integer step = Integer.valueOf(1);
* SpinnerNumberModel model = new SpinnerNumberModel(value, min, max, step);
* int fifty = model.getNumber().intValue();
*
*
* Spinners for integers and doubles are common, so special constructors
* for these cases are provided. For example to create the model in
* the previous example, one could also write:
*
* SpinnerNumberModel model = new SpinnerNumberModel(50, 0, 100, 1);
*
*
* This model inherits a ChangeListener.
* The ChangeListeners are notified
* whenever the model's value, stepSize,
* minimum, or maximum properties changes.
*
* @see JSpinner
* @see SpinnerModel
* @see AbstractSpinnerModel
* @see SpinnerListModel
* @see SpinnerDateModel
*
* @author Hans Muller
* @since 1.4
*/
@SuppressWarnings("serial") // Superclass is not serializable across versions
public class SpinnerNumberModel extends AbstractSpinnerModel implements Serializable
{
private Number stepSize, value;
// Both minimum and maximum are logically Comparable extends
// Number>, but that type is awkward to use since different
// instances of Number are not naturally Comparable. For example,
// a Double implements Comparable and an Integer
// implements Comparable. Neither Integer nor Double will
// have a bridge method for Comparable. However, it safe
// to cast Comparable> to Comparable