this question is similar to: Problem getting focus when use JPanel as JTable cell editor
Only I seem to be stuck one step back.
I have a custom TableCellEditor that returns a JPanel with a JTextField inside (simplified case). I want the JTextField to be edited when I tab into that table cell.
I have this piece of code in my JTable, in order to make the table edit on tab:
public void changeSelection(final int row, int column, boolean toggle, boolean extend){
System.out.println("selectionChanged");
super.changeSelection(row, column, toggle, extend);
if (!isCellEditable(row, column))
return;
AuthorTableEditor editor = (AuthorTableEditor) getCellEditor(row, column);
editor.setAutoFocus(this, row, column);
editCellAt(row, column);
}
The setAutoFocus is used so the methods in the AuthorTableEditor will not be called twice.
How do I get the JTextField to be edited, like what happens when I just return a JTextField in the TableCellEditor?