SpinnerDateModel (Java Platform SE 8 ) (original) (raw)

A SpinnerModel for sequences of Dates. The upper and lower bounds of the sequence are defined by properties calledstart and end and the size of the increase or decrease computed by the nextValue and previousValue methods is defined by a property called calendarField. The start and end properties can be null to indicate that the sequence has no lower or upper limit.

The value of the calendarField property must be one of thejava.util.Calendar constants that specify a field within a Calendar. The getNextValue and getPreviousValue methods change the date forward or backwards by this amount. For example, if calendarField is Calendar.DAY_OF_WEEK, then nextValue produces a Date that's 24 hours after the current value, and previousValue produces a Date that's 24 hours earlier.

The legal values for calendarField are:

However some UIs may set the calendarField before committing the edit to spin the field under the cursor. If you only want one field to spin you can subclass and ignore the setCalendarField calls.

This model inherits a ChangeListener. TheChangeListeners are notified whenever the modelsvalue, calendarField,start, or end properties changes.