I have a jcombobox as an editor inside a jtable.
I would like to switch to the editor as soon as they enter the column
with the jcombobox in it so they can start editing right away.
This is an editable jcombobox, so when tabbing through the columns in
the jtable, the first key stroke only activates the editor -- so the
second keystroke is being used instead of the first.
entering the column with the jcombobox in it, you have to hit the space
bar or the enter key before you can type in the jcombobox editor.
Otherwise, if you start typing "Smith" in the column, the "S" activates
the combobox editor and the list jumps to the "m" section instead of
the "s" section.
Appreciate the help. TIA
John McGrath - 19 Dec 2004 00:32 GMT
> entering the column with the jcombobox in it, you have to hit the space
> bar or the enter key before you can type in the jcombobox editor.
> Otherwise, if you start typing "Smith" in the column, the "S" activates
> the combobox editor and the list jumps to the "m" section instead of
> the "s" section.
Have you tried table.setSurrendersFocusOnKeystroke(true) ?

Signature
Regards,
John McGrath
doubleought77@hotmail.com - 20 Dec 2004 15:11 GMT
> Have you tried table.setSurrendersFocusOnKeystroke(true) ?
>
> --
> Regards,
>
> John McGrath
I use it all the time. It is especially useful for changing the editor
to the renderer on columns that are no longer being edited. However,
it has no effect for changing the renderer to the editor on columns
that have focus.
THX
doubleought77@hotmail.com - 24 Dec 2004 16:09 GMT
> > Have you tried table.setSurrendersFocusOnKeystroke(true) ?
> >
> > --
> > Regards,
> >
> > John McGrath
I played around enough until I found a solution.
Over-ride the columnSelectionChanged event and set the selected cell
into edit mode. This will work when clicking on a cell or entering it
via TAB keys or arrows.
public void columnSelectionChanged(ListSelectionEvent e) {
super.columnSelectionChanged(e);
editCellAt(getSelectedRow(), getSelectedColumn());
}
John McGrath - 04 Jan 2005 01:17 GMT
> I played around enough until I found a solution.
> Over-ride the columnSelectionChanged event and set the selected cell
> into edit mode. This will work when clicking on a cell or entering it
> via TAB keys or arrows.
That sounds like it would only work when you change columns. You could
move to a cell in the same column using up or down arrow key.

Signature
Regards,
John McGrath