Class SpinnerDateModel
java.lang.Object
javax.swing.AbstractSpinnerModel
javax.swing.SpinnerDateModel
- All Implemented Interfaces:
Serializable
,SpinnerModel
A
SpinnerModel
for sequences of Date
s.
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
This model inherits a ChangeListener
. The
ChangeListeners
are notified whenever the models
value
, calendarField
,
start
, or end
properties changes.
- Since:
- 1.4
- See Also:
-
Field Summary
Fields declared in class javax.swing.AbstractSpinnerModel
listenerList
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs aSpinnerDateModel
whose initialvalue
is the current date,calendarField
is equal toCalendar.DAY_OF_MONTH
, and for which there are nostart
/end
limits.SpinnerDateModel
(Date value, Comparable<Date> start, Comparable<Date> end, int calendarField) Creates aSpinnerDateModel
that represents a sequence of dates betweenstart
andend
. -
Method Summary