Class JaxoSpinnerRotationModel
- java.lang.Object
-
- javax.swing.AbstractSpinnerModel
-
- javax.swing.SpinnerNumberModel
-
- net.sf.jaxodraw.gui.swing.spinner.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
-
-
Constructor Summary
Constructors Constructor Description JaxoSpinnerRotationModel()
With initial value 0 and step size 1.JaxoSpinnerRotationModel(int value)
With given initial value and step size 1.
-
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
-
-
-
-
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 interfacejavax.swing.SpinnerModel
- Overrides:
setValue
in classjavax.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 interfacejavax.swing.SpinnerModel
- Overrides:
getPreviousValue
in classjavax.swing.SpinnerNumberModel
-
getNextValue
public java.lang.Object getNextValue()
- Specified by:
getNextValue
in interfacejavax.swing.SpinnerModel
- Overrides:
getNextValue
in classjavax.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
-
-