|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjavax.swing.AbstractSpinnerModel
javax.swing.SpinnerNumberModel
public class SpinnerNumberModel
A model used by the JSpinner component.
| Field Summary |
|---|
| Fields inherited from class javax.swing.AbstractSpinnerModel |
|---|
listenerList |
| Constructor Summary | |
|---|---|
SpinnerNumberModel()
Creates a SpinnerNumberModel with initial value 0, step 1,
and no maximum nor minimum. |
|
SpinnerNumberModel(double value,
double minimum,
double maximum,
double stepSize)
Creates a SpinnerNumberModel with double precision. |
|
SpinnerNumberModel(int value,
int minimum,
int maximum,
int stepSize)
Creates a SpinnerNumberModel with integer precision. |
|
SpinnerNumberModel(Number value,
Comparable minimum,
Comparable maximum,
Number stepSize)
Creates a SpinnerNumberModel with the given attributes. |
|
| Method Summary | |
|---|---|
Comparable |
getMaximum()
Returns the maximum value, or null if there is no maximum. |
Comparable |
getMinimum()
Returns the minimum value, or null if there is no minimum. |
Object |
getNextValue()
Returns the next value, or null if adding the step size to
the current value results in a value greater than the maximum value. |
Number |
getNumber()
Returns the current value. |
Object |
getPreviousValue()
Returns the previous value, or null if subtracting the
step size from the current value results in a value less than the minimum
value. |
Number |
getStepSize()
Returns the step size. |
Object |
getValue()
Returns the current value, which for this class is always an instance of Number. |
void |
setMaximum(Comparable newMaximum)
Sets the maximum value and, if the new value is different to the old value, sends a ChangeEvent to all registered listeners. |
void |
setMinimum(Comparable newMinimum)
Sets the minimum value and, if the new value is different to the old value, sends a ChangeEvent to all registered listeners. |
void |
setStepSize(Number newStepSize)
Sets the step size and, if the new step size is different to the old step size, sends a ChangeEvent to all registered listeners. |
void |
setValue(Object value)
Sets the current value and, if the new value is different to the old value, sends a ChangeEvent to all registered listeners. |
| 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 |
|---|
public SpinnerNumberModel()
SpinnerNumberModel with initial value 0, step 1,
and no maximum nor minimum.
public SpinnerNumberModel(double value,
double minimum,
double maximum,
double stepSize)
SpinnerNumberModel with double precision.
value - the initial valueminimum - the minimum valuemaximum - the maximum valuestepSize - the step size
IllegalArgumentException - if minimum <= value <= maximum does
not hold.
public SpinnerNumberModel(int value,
int minimum,
int maximum,
int stepSize)
SpinnerNumberModel with integer precision.
value - the initial valueminimum - the minimum valuemaximum - the maximum valuestepSize - the step size
IllegalArgumentException - if minimum <= value <= maximum does
not hold.
public SpinnerNumberModel(Number value,
Comparable minimum,
Comparable maximum,
Number stepSize)
SpinnerNumberModel with the given attributes. The
caller should ensure that both minimum and
maximum are serializable.
value - the initial value (null not permitted).minimum - the minimum value (null permitted).maximum - the maximum value (null permitted).stepSize - the step size (null not permitted).
IllegalArgumentException - if minimum <= value <= maximum
does not hold
IllegalArgumentException - if value is
null.
IllegalArgumentException - if stepSize is
null.| Method Detail |
|---|
public void setValue(Object value)
ChangeEvent to all registered listeners.
setValue in interface SpinnerModelvalue - the new value (null not permitted, must be an
instance of Number).
IllegalArgumentException - if value is not an instance
of Number.public Object getValue()
Number.
getValue in interface SpinnerModelgetNumber()public Object getNextValue()
null if adding the step size to
the current value results in a value greater than the maximum value.
The current value is not changed.
getNextValue in interface SpinnerModelnull if the current value is the
maximum value represented by this model.public Object getPreviousValue()
null if subtracting the
step size from the current value results in a value less than the minimum
value. The current value is not changed.
getPreviousValue in interface SpinnerModelnull if the current value
is the minimum value represented by this model.public Number getNumber()
public Comparable getMinimum()
null if there is no minimum.
setMinimum(Comparable)public void setMinimum(Comparable newMinimum)
ChangeEvent to all registered listeners. A
null value is interpreted as "no minimum value". No check
is made to ensure that the new minimum is less than or equal to the
current value, the caller is responsible for ensuring that this
relationship holds. In addition, the caller should ensure that
newMinimum is Serializable.
newMinimum - the new minimum value (null permitted).getMinimum()public Comparable getMaximum()
null if there is no maximum.
getMinimum(),
setMaximum(Comparable)public void setMaximum(Comparable newMaximum)
ChangeEvent to all registered listeners. A
null value is interpreted as "no maximum value". No check
is made to ensure that the new maximum is greater than or equal to the
current value, the caller is responsible for ensuring that this
relationship holds. In addition, the caller should ensure that
newMaximum is Serializable.
newMaximum - the new maximum (null permitted).getMaximum()public Number getStepSize()
null).public void setStepSize(Number newStepSize)
ChangeEvent to all registered listeners.
newStepSize - the new step size (null not permitted).
IllegalArgumentException - if newStepSize is
null.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||