uic.model
Class UICSpinnerNumberModel

java.lang.Object
  extended byjavax.swing.AbstractSpinnerModel
      extended byjavax.swing.SpinnerNumberModel
          extended byuic.model.UICSpinnerNumberModel
All Implemented Interfaces:
Serializable, SpinnerModel

public class UICSpinnerNumberModel
extends SpinnerNumberModel

Extends SpinnerNumberModel to make sure stepsize is used to check if the value that is set is allowed SpinnerNumberModel model = new SpinnerNumberModel(0, 0, 10, 2); model.setValue(0); // will result in 0 in the ui model.setValue(2); // will result in 2 in the ui model.setValue(1); // will result in 2 in the ui SpinnerNumberModel model = new SpinnerNumberModel(1, 1, 10, 2); model.setValue(1); // will result in 1 in the ui model.setValue(3); // will result in 3 in the ui model.setValue(2); // will result in 3 in the ui

Since:
1.2
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.AbstractSpinnerModel
listenerList
 
Constructor Summary
UICSpinnerNumberModel()
          Constructs a SpinnerNumberModel with no minimum or maximum value, stepSize equal to one, and an initial value of zero.
UICSpinnerNumberModel(double value, double minimum, double maximum, double stepSize)
          Constructs a SpinnerNumberModel with the specified value, minimum/maximum bounds, and stepSize.
UICSpinnerNumberModel(int value, int minimum, int maximum, int stepSize)
          Constructs a SpinnerNumberModel with the specified value, minimum/maximum bounds, and stepSize.
UICSpinnerNumberModel(Number value, Comparable minimum, Comparable maximum, Number stepSize)
          Constructs a SpinnerModel that represents a closed sequence of numbers from minimum to maximum.
 
Method Summary
 void setValue(Object value)
          Override setValue to obey getStepSize SpinnerNumberModel model = new SpinnerNumberModel(0, 0, 10, 2); model.setValue(0); // will result in 0 in the ui model.setValue(2); // will result in 2 in the ui model.setValue(1); // will result in 2 in the ui SpinnerNumberModel model = new SpinnerNumberModel(1, 1, 10, 2); model.setValue(1); // will result in 1 in the ui model.setValue(3); // will result in 3 in the ui model.setValue(2); // will result in 3 in the ui
 
Methods inherited from class javax.swing.SpinnerNumberModel
getMaximum, getMinimum, getNextValue, getNumber, getPreviousValue, getStepSize, getValue, setMaximum, setMinimum, setStepSize
 
Methods inherited from class javax.swing.AbstractSpinnerModel
addChangeListener, fireStateChanged, getChangeListeners, getListeners, removeChangeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UICSpinnerNumberModel

public UICSpinnerNumberModel()
Constructs a SpinnerNumberModel with no minimum or maximum value, stepSize equal to one, and an initial value of zero.


UICSpinnerNumberModel

public UICSpinnerNumberModel(double value,
                             double minimum,
                             double maximum,
                             double stepSize)
Constructs a SpinnerNumberModel with the specified value, minimum/maximum bounds, and stepSize.


UICSpinnerNumberModel

public UICSpinnerNumberModel(int value,
                             int minimum,
                             int maximum,
                             int stepSize)
Constructs a SpinnerNumberModel with the specified value, minimum/maximum bounds, and stepSize.


UICSpinnerNumberModel

public UICSpinnerNumberModel(Number value,
                             Comparable minimum,
                             Comparable maximum,
                             Number stepSize)
Constructs a SpinnerModel that represents a closed sequence of numbers from minimum to maximum.

Method Detail

setValue

public void setValue(Object value)
Override setValue to obey getStepSize SpinnerNumberModel model = new SpinnerNumberModel(0, 0, 10, 2); model.setValue(0); // will result in 0 in the ui model.setValue(2); // will result in 2 in the ui model.setValue(1); // will result in 2 in the ui SpinnerNumberModel model = new SpinnerNumberModel(1, 1, 10, 2); model.setValue(1); // will result in 1 in the ui model.setValue(3); // will result in 3 in the ui model.setValue(2); // will result in 3 in the ui

Parameters:
value - the value to be set to the model


Copyright © 2002,2003 Thomas Zander Available under the Free Apache licence