Hi, I the following problem with a JCombobox editor in JTable.
I want the first keystroke in the JTable to be passed in the Editor of
the JCombobox. In JTable, the following code handles the keyboard
events:
if (editorComponent instanceof JComponent) {
retValue = ((JComponent)editorComponent).processKeyBinding(ks, e,
WHEN_FOCUSED, pressed);
// If we have started an editor as a result of the user
// pressing a key and the surrendersFocusOnKeystroke property
// is true, give the focus to the new editor.
if (getSurrendersFocusOnKeystroke()) {
editorComponent.requestFocus();
}
}
Shouldn't we first surrender the focus and then pass the keyboard
event?
I have to type a char twice before the editor of JCombobox receives it.
If this
is the intended behaviour of the JTable, can anyone tell me how to
resent the keyboard event to the JComboBox? Or am I missing the point
completely?
Thanks
Christian Kaufhold - 22 Jun 2005 10:49 GMT
> I want the first keystroke in the JTable to be passed in the Editor of
> the JCombobox. In JTable, the following code handles the keyboard
[quoted text clipped - 14 lines]
> Shouldn't we first surrender the focus and then pass the keyboard
> event?
It does not matter since focus requests may be handled asynchronously.
> I have to type a char twice before the editor of JCombobox receives it.
> If this
> is the intended behaviour of the JTable, can anyone tell me how to
> resent the keyboard event to the JComboBox? Or am I missing the point
> completely?
Please post a compilable example so I can play with it.
Christian