public class AgeSpinnerModel
extends javax.swing.AbstractSpinnerModel
Constructor and Description |
---|
AgeSpinnerModel(Age value)
Create an AgeSpinnerModel with the specified initial value and default step size of 5 seconds.
|
AgeSpinnerModel(long value,
long stepSize)
Create an AgeSpinnerModel with the specified initial value and step size.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
getNextValue()
Return the object in the sequence that comes after the object returned
by
getValue() . |
java.lang.Object |
getPreviousValue()
Return the object in the sequence that comes before the object returned
by
getValue() . |
java.lang.Object |
getValue()
The current element of the sequence.
|
void |
setStepSize(long stepSize)
Change the step size of the model.
|
void |
setValue(java.lang.Object value)
Changes current value of the model, typically this value is displayed
by the
editor part of a JSpinner . |
public AgeSpinnerModel(long value, long stepSize) throws java.lang.IllegalArgumentException
value
- long value in millisecondsstepSize
- long step size in millisecondsjava.lang.IllegalArgumentException
- if value or step size are not validpublic AgeSpinnerModel(Age value) throws java.lang.IllegalArgumentException
value
- Age value in millisecondsjava.lang.IllegalArgumentException
- if value is not validpublic void setStepSize(long stepSize) throws java.lang.IllegalArgumentException
stepSize
- long step size in millisecondsjava.lang.IllegalArgumentException
- if step size is not valid or existing value not consistent with new step sizepublic java.lang.Object getValue()
editor
part of a JSpinner
.setValue(java.lang.Object)
public void setValue(java.lang.Object value)
editor
part of a JSpinner
.
If the SpinnerModel
implementation doesn't support
the specified value then an IllegalArgumentException
is thrown. For example a SpinnerModel
for numbers might
only support values that are integer multiples of ten. In
that case, model.setValue(new Number(11))
would throw an exception.value
- new value for the modeljava.lang.IllegalArgumentException
- if value
isn't allowedgetValue()
public java.lang.Object getNextValue()
getValue()
. If the end of the sequence has been reached
then return null. Calling this method does not effect value
.getValue()
,
getPreviousValue()
public java.lang.Object getPreviousValue()
getValue()
. If the end of the sequence has been reached then
return null. Calling this method does not effect value
.getValue()
,
getNextValue()