#3 CalendarPane requests focus causing editing to stop

closed-fixed
nobody
None
5
2006-11-27
2006-05-31
kroe
No

I have a JPanel that is used to render an cell in a
JTable. The DatePicker control is being used in this
JPanel. I have the terminateEditOnFocusLost
parameter set to true.

The problem occurs when I am editing a cell in the
table and click on the ... to expand the calendar
control. The button does not request focus (as it
should not), but when the calendar opens it requests
focus. This takes focus away from the JPanel that is
in in the table cell, and causes editing to be
terminated which commits the change to the cell and
causes the DatePicker to collapse. The observed
behavior when clicking ... is that the date picker
opens momentarily then quickly closes making it
impossible to edit.

I fixed this by making a change to the
BasicDatePickerUI class. The change is the addition
of the "calendarPane.setFocusable(false)" line.

It would be great if you could add this change into
the Microba distribution.

// calendar
calendarPane = new CalendarPane(peer.getStyle());
calendarPane.setFocusable(false);
calendarPane.setShowTodayButton(peer.isShowTodayButton
());
calendarPane.setFocusLostBehavior
(JFormattedTextField.REVERT);
calendarPane.setFocusCycleRoot(true);

Discussion

  • teddybear
    teddybear
    2006-11-27

    Logged In: YES
    user_id=1118136
    Originator: NO

    "dropdownFocusable" boolean property added to DatePicker in version greater than 0.4.3.4

     
  • teddybear
    teddybear
    2006-11-27

    • status: open --> closed-fixed