Class JaxoSpinnerRotationModel
java.lang.Object
javax.swing.AbstractSpinnerModel
javax.swing.SpinnerNumberModel
net.sf.jaxodraw.gui.swing.spinner.JaxoSpinnerRotationModel
- All Implemented Interfaces:
Serializable
,SpinnerModel
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:
-
Field Summary
Fields inherited from class javax.swing.AbstractSpinnerModel
listenerList
-
Constructor Summary
ConstructorsConstructorDescriptionWith initial value 0 and step size 1.JaxoSpinnerRotationModel
(int value) With given initial value and step size 1. -
Method Summary
Modifier and TypeMethodDescriptionfinal int
SpinnerNumberModel.getValue()
as an int.A new JSpinner with an editor better fit to edit angles than the default number editor.final void
setRotationValue
(int newValue) setValue(java.lang.Object)
with int argument.void
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
-
Constructor Details
-
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 Details
-
getRotationValue
public final int getRotationValue()SpinnerNumberModel.getValue()
as an int.- Returns:
- int
-
setValue
- Specified by:
setValue
in interfaceSpinnerModel
- Overrides:
setValue
in classSpinnerNumberModel
-
setRotationValue
public final void setRotationValue(int newValue) setValue(java.lang.Object)
with int argument.- Parameters:
newValue
- new rotation value.
-
getPreviousValue
- Specified by:
getPreviousValue
in interfaceSpinnerModel
- Overrides:
getPreviousValue
in classSpinnerNumberModel
-
getNextValue
- Specified by:
getNextValue
in interfaceSpinnerModel
- Overrides:
getNextValue
in classSpinnerNumberModel
-
newSpinner
A new JSpinner with an editor better fit to edit angles than the default number editor.- Returns:
- JSpinner
-