Java 8 DatePicker and editable ComboBox behavior change between 8u51 and 8u60

前端 未结 2 1565
一生所求
一生所求 2021-01-14 15:47

We have searched this forum and the web extensively and have not found anything related to this issue so I felt compelled to post this question here...

We have obse

2条回答
  •  被撕碎了的回忆
    2021-01-14 16:06

    Here's my workaround:

        combo.getEditor().focusedProperty().addListener((obs, old, isFocused) -> { 
            if (!isFocused) { 
                combo.setValue(combo.getConverter().fromString(combo.getEditor().getText()));
            } 
        }); 
    

    As is pointed out in the official bug report, you might want to check to see if the value is already set to avoid any potential side-effects of calling it again.

提交回复
热议问题