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 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 intSpinnerNumberModel.getValue()as an int.A new JSpinner with an editor better fit to edit angles than the default number editor.final voidsetRotationValue(int newValue) setValue(Object)with int argument.voidMethods inherited from class SpinnerNumberModel
getMaximum, getMinimum, getNumber, getStepSize, getValue, setMaximum, setMinimum, setStepSizeMethods inherited from class 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
-
setValue
- Specified by:
setValuein interfaceSpinnerModel- Overrides:
setValuein classSpinnerNumberModel
-
setRotationValue
public final void setRotationValue(int newValue) setValue(Object)with int argument.- Parameters:
newValue- new rotation value.
-
getPreviousValue
- Specified by:
getPreviousValuein interfaceSpinnerModel- Overrides:
getPreviousValuein classSpinnerNumberModel
-
getNextValue
- Specified by:
getNextValuein interfaceSpinnerModel- Overrides:
getNextValuein classSpinnerNumberModel
-
newSpinner
A new JSpinner with an editor better fit to edit angles than the default number editor.- Returns:
- JSpinner
-