Name: ooR10001 Date: 12/22/2000
Specification for javax.swing.SpinnerdateModel.setStart() has a sample which will no
be compiled successfully.
The javadoc says:
------------------------------------------------------------
setStart
public void setStart(Comparable start)
Change the lower limit for Dates in this sequence. If start is null, then there
is no lower limit. No bounds checking is done here: the new start value may
invalidate the (start <= value <= end) invariant enforced by the constructors.
This is to simplify updating the model. Naturally one should ensure that the
invariant is true before calling the nextValue, previousValue, or setValue
methods.
Typically this property is a Date however it's possible to use a Comparable
with a compareTo method for Dates. For example start might be an instance
of a class like this:
MyStartDate implements Comparable {
long t = 12345; ^^^^^^^^^^
public int compareTo(Date d) {
^^^^
return (t < d.getTime() ? -1 : (t == d.getTime() ? 0 : 1));
}
}
------------------------------------------------------------
Sample class implements Comarable and must define compareTo(Object) method. This
sample class is not implements Comaprable in fact because it is not define such
method - only compareTo(Date) defined. It causes compilation failure.
It needs to be fixed.
======================================================================