我试图将DTO上的ObjectProperty<LocalDate>
绑定到TextField
,并且无法使其工作。如何在JavaFX中双向绑定LocalDate到TextField
这是我如何把它设置了:
dateOfBirthTextField.setTextFormatter(new TextFormatter<>(new LocalDateEnhancedStringConverter()));
person.birthdayProperty().bindBidirectional(dateOfBirthTextField.textProperty(), new LocalDateEnhancedStringConverter());
但是,这是给我下面的编译错误:
The method bindBidirectional(Property) in the type ObjectProperty is not applicable for the arguments (StringProperty, LocalDateEnhancedStringConverter)
不太一定要尝试下呢?
不幸的是我的用户不希望日期选择器,所以我坚持这个用例。 –