Class IntegerSpinner


  • public class IntegerSpinner
    extends java.lang.Object
    Creates a component for editing Integer values using an IntegerTextField and a JSpinner.
    • Constructor Summary

      Constructors 
      Constructor Description
      IntegerSpinner​(javax.swing.SpinnerNumberModel spinnerModel)
      Creates a new IntegerSpinner using the given spinner model.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addChangeListener​(javax.swing.event.ChangeListener listener)
      Adds a ChangeListener to the model's listener list.
      protected void fireStateChanged()
      Run each ChangeListeners stateChanged() method.
      javax.swing.JSpinner getSpinner()
      Returns the JSpinner that has been attached to the text field.
      IntegerTextField getTextField()
      Returns the IntegerTextField that has been attached to the spinner.
      void removeChangeListener​(javax.swing.event.ChangeListener listener)
      Removes a ChangeListener from the model's listener list.
      void setValue​(java.lang.Number value)
      Sets the given value to both the spinner and the text field.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • IntegerSpinner

        public IntegerSpinner​(javax.swing.SpinnerNumberModel spinnerModel)
        Creates a new IntegerSpinner using the given spinner model.
        Parameters:
        spinnerModel - the spinner model to use in the JSpinner.
    • Method Detail

      • getSpinner

        public javax.swing.JSpinner getSpinner()
        Returns the JSpinner that has been attached to the text field.
        Returns:
        the JSpinner that has been attached to the text field
      • getTextField

        public IntegerTextField getTextField()
        Returns the IntegerTextField that has been attached to the spinner.
        Returns:
        the IntegerTextField that has been attached to the spinner.
      • setValue

        public void setValue​(java.lang.Number value)
        Sets the given value to both the spinner and the text field.
        Parameters:
        value - the value to set.
      • addChangeListener

        public void addChangeListener​(javax.swing.event.ChangeListener listener)
        Adds a ChangeListener to the model's listener list. The ChangeListeners must be notified when the models value changes.
        Parameters:
        listener - the ChangeListener to add
      • removeChangeListener

        public void removeChangeListener​(javax.swing.event.ChangeListener listener)
        Removes a ChangeListener from the model's listener list.
        Parameters:
        listener - the ChangeListener to remove
      • fireStateChanged

        protected void fireStateChanged()
        Run each ChangeListeners stateChanged() method.
        See Also:
        setValue(java.lang.Number), EventListenerList