I have a SpinnerNumberModel
and some ChangeListener
s.
But the ChangeListeners only get notified when the spinner number changes. Is there a way to initiate an event that propagates to the ChangeListeners even if the new spinner number is the same as the previous value?
SpinnerNumberModel sends an event to the registered change listeners in exactly these methods:
1. public void setValue(Object value)
2. public void setStepSize(Number stepSize)
3. public void setMaximum(Comparable maximum)
4. public void setMinimum(Comparable minimum)
In each of these methods, an event is only issued iff the value passed as the parameter actually differs from the current value.
However, you could write your own SpinnerModel
(e.g. by subclassing SpinnerNumberModel
) and fire all the events you want. If your implementation inherits from AbstractSpinnerModel
, as SpinnerNumberModel
does, you'll have a handy fireStateChanged
method available for sending events: