Class JaxoSpinnerRotationModel

  • All Implemented Interfaces:
    java.io.Serializable, javax.swing.SpinnerModel

    public class JaxoSpinnerRotationModel
    extends javax.swing.SpinnerNumberModel
    Specialization of SpinnerNumberModel that only allows integers to avoid rounding issues. Treats them as rotation angles, normalizing to the interval ]-180, 180]. getPrevious/NextValue also act circularly. The minimum and maximum are always set to [-179, 180] and should not be changed.
    Since:
    2.0
    See Also:
    Serialized Form
    • Field Summary

      • Fields inherited from class javax.swing.AbstractSpinnerModel

        listenerList
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object getNextValue()
      java.lang.Object getPreviousValue()
      int getRotationValue()
      SpinnerNumberModel.getValue() as an int.
      javax.swing.JSpinner newSpinner()
      A new JSpinner with an editor better fit to edit angles than the default number editor.
      void setRotationValue​(int newValue)
      setValue(java.lang.Object) with int argument.
      void setValue​(java.lang.Object value)
      • Methods inherited from class javax.swing.SpinnerNumberModel

        getMaximum, getMinimum, getNumber, 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

      • JaxoSpinnerRotationModel

        public JaxoSpinnerRotationModel()
        With initial value 0 and step size 1.
      • JaxoSpinnerRotationModel

        public JaxoSpinnerRotationModel​(int value)
        With given initial value and step size 1.
        Parameters:
        value - initial value.
    • Method Detail

      • getRotationValue

        public final int getRotationValue()
        SpinnerNumberModel.getValue() as an int.
        Returns:
        int
      • setValue

        public void setValue​(java.lang.Object value)
        Specified by:
        setValue in interface javax.swing.SpinnerModel
        Overrides:
        setValue in class javax.swing.SpinnerNumberModel
      • setRotationValue

        public final void setRotationValue​(int newValue)
        setValue(java.lang.Object) with int argument.
        Parameters:
        newValue - new rotation value.
      • getPreviousValue

        public java.lang.Object getPreviousValue()
        Specified by:
        getPreviousValue in interface javax.swing.SpinnerModel
        Overrides:
        getPreviousValue in class javax.swing.SpinnerNumberModel
      • getNextValue

        public java.lang.Object getNextValue()
        Specified by:
        getNextValue in interface javax.swing.SpinnerModel
        Overrides:
        getNextValue in class javax.swing.SpinnerNumberModel
      • newSpinner

        public javax.swing.JSpinner newSpinner()
        A new JSpinner with an editor better fit to edit angles than the default number editor.
        Returns:
        JSpinner