public void setDateFormatString(String dateFormatString) {
        try {
            dateFormatter.applyPattern(dateFormatString);
        } catch (RuntimeException e) {
            dateFormatter = (SimpleDateFormat) DateFormat
                    .getDateInstance(DateFormat.MEDIUM);
            dateFormatter.setLenient(false);
        }
        this.dateFormatString = dateFormatter.toPattern();
        setToolTipText(this.dateFormatString);

        if (date != null) {
            ((JSpinner.DateEditor) getEditor()).getFormat().applyPattern(
                    this.dateFormatString);
        } else {
            ((JSpinner.DateEditor) getEditor()).getFormat().applyPattern("");
        }

        if (date != null) {
            String text = dateFormatter.format(date);
            ((JSpinner.DateEditor) getEditor()).getTextField().setText(text);
        }
    }