A
SpinnerModel for sequences of
Dates. The upper and lower bounds of the sequence are defined by properties called
start 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 the java.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:
-
Calendar.ERA
-
Calendar.YEAR
-
Calendar.MONTH
-
Calendar.WEEK_OF_YEAR
-
Calendar.WEEK_OF_MONTH
-
Calendar.DAY_OF_MONTH
-
Calendar.DAY_OF_YEAR
-
Calendar.DAY_OF_WEEK
-
Calendar.DAY_OF_WEEK_IN_MONTH
-
Calendar.AM_PM
-
Calendar.HOUR
-
Calendar.HOUR_OF_DAY
-
Calendar.MINUTE
-
Calendar.SECOND
-
Calendar.MILLISECOND
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. The ChangeListeners are notified whenever the models value, calendarField, start, or end properties changes.