如何处理将文本粘贴到组件:com.toedter.calendar.IDateEditor?

时间:2018-09-02 12:12:02

标签: java

Java8。在我的项目中,我使用了swing组件:com.toedter.calendar

这是扩展JDialog的代码片段;

import com.toedter.calendar.IDateEditor;
import com.toedter.calendar.JDateChooser;
import com.toedter.calendar.JSpinnerDateEditor;

private IDateEditor spinnerDateEditorOpenDate, spinnerDateEditorNextDate;

spinnerDateEditorOpenDate = new JSpinnerDateEditor();
        spinnerDateEditorOpenDate.setDateFormatString(defaultFilterDateFormat);
        dateAccountOpenDateChooser = GUIFactory.createDateChooser(spinnerDateEditorOpenDate, isRequired);
        dateAccountOpenDateChooser.setName(GUIFactory.createEditableName(bsFieldName));
        dateAccountOpenDateChooser.setDateFormatString(defaultFilterDateFormat);
        bsFieldValue = M2Check.getBSFieldValue(m2Document, bsFieldName);
        if (bsFieldValue != null) {
            Date date = DateManager.getDateFromFormat(bsFieldValue);
            dateAccountOpenDateChooser.setDate(date);
        }
        panel.add(dateAccountOpenDateChooser, gbcContentPane);

工作正常:

enter image description here

但是当我通过以正确的日期格式(例如 2017.12。)粘贴文本输入日期时,dateAccountOpenDateChooser.getDate()返回

如何处理将文本粘贴到组件JDateChooser的问题?

0 个答案:

没有答案