JTable AbstractCellEditor loses first keystoke
843805Jan 9 2006 — edited Jan 12 2006I have extended AbstractCellEditor to return a JPanel on getTableCellEditorComponent(). The JPanel contains a JTextField (positioned to left or right side of the pane depending on dr/cr).
Focus with the mouse works as expected.
My problem occurs when tab is used to select the cell
Pressing a key causes the JPanel FocusListener() to send grabFocus() to the JTexField which commences editing.
That invoking keystroke is lost, instead of being passed on to the JTextField (in the same manner as the String cell editor would, for example).
I tried a KeyListener on the JPanel, but this never sees a KeyEvent. A KeyListener on the JTable capturing every keystroke could work but seems a bit over-engineered (a la Mickey Mouse).
Is there a simple way of getting a hold of that keystroke and passing it on?