Class AgeSpinnerModel

java.lang.Object
javax.swing.AbstractSpinnerModel
org.ka2ddo.yaac.gui.AgeSpinnerModel
All Implemented Interfaces:
Serializable, SpinnerModel

public class AgeSpinnerModel extends AbstractSpinnerModel
This model allows spinning for a specific Age value.
Author:
Andrew Pavlin, KA2DDO
See Also:
  • Constructor Details

    • AgeSpinnerModel

      public AgeSpinnerModel(long value, long stepSize) throws IllegalArgumentException
      Create an AgeSpinnerModel with the specified initial value and step size.
      Parameters:
      value - long value in milliseconds
      stepSize - long step size in milliseconds
      Throws:
      IllegalArgumentException - if value or step size are not valid
    • AgeSpinnerModel

      public AgeSpinnerModel(Age value) throws IllegalArgumentException
      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

      public void setStepSize(long stepSize) throws IllegalArgumentException
      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

      public Object getValue()
      The current element of the sequence. This element is usually displayed by the editor part of a JSpinner.
      Returns:
      the current spinner value.
      See Also:
    • setValue

      public void setValue(Object value)
      Changes current value of the model, typically this value is displayed by the 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.
      Parameters:
      value - new value for the model
      Throws:
      IllegalArgumentException - if value isn't allowed
      See Also:
    • getNextValue

      public Object getNextValue()
      Return the object in the sequence that comes after the object returned by getValue(). If the end of the sequence has been reached then return null. Calling this method does not effect value.
      Returns:
      the next legal value or null if one doesn't exist
      See Also:
    • getPreviousValue

      public Object getPreviousValue()
      Return the object in the sequence that comes before the object returned by getValue(). If the end of the sequence has been reached then return null. Calling this method does not effect value.
      Returns:
      the previous legal value or null if one doesn't exist
      See Also: