Package org.ka2ddo.yaac.gui
Class AgeSpinnerModel
java.lang.Object
javax.swing.AbstractSpinnerModel
org.ka2ddo.yaac.gui.AgeSpinnerModel
- All Implemented Interfaces:
Serializable
,SpinnerModel
This model allows spinning for a specific Age value.
- Author:
- Andrew Pavlin, KA2DDO
- See Also:
-
Field Summary
Fields inherited from class javax.swing.AbstractSpinnerModel
listenerList
-
Constructor Summary
ConstructorDescriptionAgeSpinnerModel
(long value, long stepSize) Create an AgeSpinnerModel with the specified initial value and step size.AgeSpinnerModel
(Age value) Create an AgeSpinnerModel with the specified initial value and default step size of 5 seconds. -
Method Summary
Modifier and TypeMethodDescriptionReturn the object in the sequence that comes after the object returned bygetValue()
.Return the object in the sequence that comes before the object returned bygetValue()
.getValue()
The current element of the sequence.void
setStepSize
(long stepSize) Change the step size of the model.void
Changes current value of the model, typically this value is displayed by theeditor
part of aJSpinner
.Methods inherited from class javax.swing.AbstractSpinnerModel
addChangeListener, fireStateChanged, getChangeListeners, getListeners, removeChangeListener
-
Constructor Details
-
AgeSpinnerModel
Create an AgeSpinnerModel with the specified initial value and step size.- Parameters:
value
- long value in millisecondsstepSize
- long step size in milliseconds- Throws:
IllegalArgumentException
- if value or step size are not valid
-
AgeSpinnerModel
Create an AgeSpinnerModel with the specified initial value and default step size of 5 seconds.- Parameters:
value
- Age value in milliseconds- Throws:
IllegalArgumentException
- if value is not valid
-
-
Method Details
-
setStepSize
Change the step size of the model.- Parameters:
stepSize
- long step size in milliseconds- Throws:
IllegalArgumentException
- if step size is not valid or existing value not consistent with new step size
-
getValue
The current element of the sequence. This element is usually displayed by theeditor
part of aJSpinner
.- Returns:
- the current spinner value.
- See Also:
-
setValue
Changes current value of the model, typically this value is displayed by theeditor
part of aJSpinner
. If theSpinnerModel
implementation doesn't support the specified value then anIllegalArgumentException
is thrown. For example aSpinnerModel
for numbers might only support values that are integer multiples of ten. In that case,model.setValue(new Number(11))
would throw an exception.- Parameters:
value
- new value for the model- Throws:
IllegalArgumentException
- ifvalue
isn't allowed- See Also:
-
getNextValue
Return the object in the sequence that comes after the object returned bygetValue()
. If the end of the sequence has been reached then return null. Calling this method does not effectvalue
.- Returns:
- the next legal value or null if one doesn't exist
- See Also:
-
getPreviousValue
Return the object in the sequence that comes before the object returned bygetValue()
. If the end of the sequence has been reached then return null. Calling this method does not effectvalue
.- Returns:
- the previous legal value or null if one doesn't exist
- See Also:
-