-
Bug
-
Resolution: Fixed
-
P4
-
jfx11, 8, jfx17
-
generic
-
generic
The DatePicker has two constructors.
One default constructor with no parameters and a second with 'LocalDate' as parameter.
The default constructor uses 'this(null)' and adds two additional listener after.
If the second constructor with 'LocalDate' is used those two listener won't be added.
Fix would be the same as in other controls:
The listener should be added at the second constructor where the first constructor is also referring to.
### SOURCE ###
public DatePicker() {
this(null);
// Here the constructor will add two additional listeners
valueProperty().addListener(observable -> {
[...]
});
chronologyProperty().addListener(observable -> {
[...]
}
});
}
public DatePicker(LocalDate localDate) {
setValue(localDate);
getStyleClass().add(DEFAULT_STYLE_CLASS);
setAccessibleRole(AccessibleRole.DATE_PICKER);
setEditable(true);
}
### SOURCE END ###
One default constructor with no parameters and a second with 'LocalDate' as parameter.
The default constructor uses 'this(null)' and adds two additional listener after.
If the second constructor with 'LocalDate' is used those two listener won't be added.
Fix would be the same as in other controls:
The listener should be added at the second constructor where the first constructor is also referring to.
### SOURCE ###
public DatePicker() {
this(null);
// Here the constructor will add two additional listeners
valueProperty().addListener(observable -> {
[...]
});
chronologyProperty().addListener(observable -> {
[...]
}
});
}
public DatePicker(LocalDate localDate) {
setValue(localDate);
getStyleClass().add(DEFAULT_STYLE_CLASS);
setAccessibleRole(AccessibleRole.DATE_PICKER);
setEditable(true);
}
### SOURCE END ###
- relates to
-
JDK-8295339 DatePicker updates its value property with wrong date when dialog closes
- Resolved