D
dbaldes
Hello,
I have a JTable with some custom editors. I set the
"terminateEditOnFocusLost" property to have editors get removed
properly when the user "leaves" the table. The problem arises when the
user is editing a cell of the table and then clicks on another cell to
edit that one:
- editing of the cell currently being edited is stopped (good)
- the editor of the new cell is loaded (getEditorComponent called)
(good)
- JTable loses focus for some reason to somewhere (probably bad)
- JTable stops editing of the newly clicked cell (due to
terminateEditOnFocusLost i guess) (bad)
So the user has to click a second time on the new cell to edit it,
cause the editor was stopped right after being loaded on the first
click..
Without "terminateEditOnFocusLost" the behaviour is also strange: on
most Editors (simple text fields f.e.) it works well (problem described
above does not arise) , but on a custom ComboBox editor the combobox
pops up and closes again on the first click, BUT only when the cell
editor used before was also the combobox editor.. so the user has to
click a second time on the combobox to get the drop down list. When the
user was editing another column (with other editor) before, the
combobox pops up its drop down list and stays open on the first click
as I expect it to.
What i want is: 1. the behaviour of terminateEditOnFocusLost without
editors being removed when i click to edit a cell and 2. the combobox
to pop up and stay open on 1st click in any case
I already tried overriding "shouldSelectCell" in the editors (which is
not called any more, i read somewhere) because I suspected it to be
related to focusing, and messing around with JTable.requestFocus, and
the "focusable" property of the JTable is true - I did not get it to
work properly up to now.
Can you help me with this problem?
Thanks in advance!
Regards,
Daniel
I have a JTable with some custom editors. I set the
"terminateEditOnFocusLost" property to have editors get removed
properly when the user "leaves" the table. The problem arises when the
user is editing a cell of the table and then clicks on another cell to
edit that one:
- editing of the cell currently being edited is stopped (good)
- the editor of the new cell is loaded (getEditorComponent called)
(good)
- JTable loses focus for some reason to somewhere (probably bad)
- JTable stops editing of the newly clicked cell (due to
terminateEditOnFocusLost i guess) (bad)
So the user has to click a second time on the new cell to edit it,
cause the editor was stopped right after being loaded on the first
click..
Without "terminateEditOnFocusLost" the behaviour is also strange: on
most Editors (simple text fields f.e.) it works well (problem described
above does not arise) , but on a custom ComboBox editor the combobox
pops up and closes again on the first click, BUT only when the cell
editor used before was also the combobox editor.. so the user has to
click a second time on the combobox to get the drop down list. When the
user was editing another column (with other editor) before, the
combobox pops up its drop down list and stays open on the first click
as I expect it to.
What i want is: 1. the behaviour of terminateEditOnFocusLost without
editors being removed when i click to edit a cell and 2. the combobox
to pop up and stay open on 1st click in any case
I already tried overriding "shouldSelectCell" in the editors (which is
not called any more, i read somewhere) because I suspected it to be
related to focusing, and messing around with JTable.requestFocus, and
the "focusable" property of the JTable is true - I did not get it to
work properly up to now.
Can you help me with this problem?
Thanks in advance!
Regards,
Daniel