net.sf.jaxodraw.gui.swing.spinner
Class JaxoSpinnerRotationModel

java.lang.Object
  extended by javax.swing.AbstractSpinnerModel
      extended by javax.swing.SpinnerNumberModel
          extended by net.sf.jaxodraw.gui.swing.spinner.JaxoSpinnerRotationModel
All Implemented Interfaces:
Serializable, SpinnerModel

public class JaxoSpinnerRotationModel
extends 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
 
Constructor Summary
JaxoSpinnerRotationModel()
          With initial value 0 and step size 1.
JaxoSpinnerRotationModel(int value)
          With given initial value and step size 1.
 
Method Summary
 Object getNextValue()
          
 Object getPreviousValue()
          
 int getRotationValue()
          SpinnerNumberModel.getValue() as an int.
 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(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(Object value)

Specified by:
setValue in interface SpinnerModel
Overrides:
setValue in class SpinnerNumberModel

setRotationValue

public final void setRotationValue(int newValue)
setValue(java.lang.Object) with int argument.

Parameters:
newValue - new rotation value.

getPreviousValue

public Object getPreviousValue()

Specified by:
getPreviousValue in interface SpinnerModel
Overrides:
getPreviousValue in class SpinnerNumberModel

getNextValue

public Object getNextValue()

Specified by:
getNextValue in interface SpinnerModel
Overrides:
getNextValue in class SpinnerNumberModel

newSpinner

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

Returns:
JSpinner


Copyright © 2003-2011 The JaxoDraw team. All Rights Reserved.