Hi, all I add KeyListener to my JTable and hope it can catch the key event such as TAB key or ENTER key pressed. But after I edit one cell and press TAB, it does not fire the KeyEvent, only after I press TAB again, it catch the event and do the relevant business logic. I wonder why the first TAB key pressed is not caught? P.S. if I do not edit one cell and press TAB, it will catch the TAB key pressed event.
posted 13 years ago
Hi Joy, some days ago we had a similar post in this forum. Somebody had the problem, that he was not able to catch TAB key event in JTextField. We found out, that we need to call the method setFocusTraversalKeysEnabled(true) to the JTextField. I think, the same happens to you, because the JTextField is probably your TableCellEditor. So it seems to me, that you need to writ your own TableCellEditor, where you call the above mentioned method. Good Luck Rene