JTable’s default behavior is changing focus to next cell and I want to force it to move focus to next component (e.g. JTextField) on TAB key pressed.
I overrided isCellEditable method of DefaultTableModel to always return false:
public boolean isCellEditable(int rowIndex, int columnIndex) {
return false;
}
But it still doesn’t change focus to next component!
How should I make JTable change focus to next component instead of next cell?
If you really want this, you need to change the default behavior of the tables action map.
Then you need a couple of actions to handle the traversal
Another approach would be to disable the underlying
Action…(haven’t tested this)
The benefit of this approach is can enable/disable the behaviour as you need it without needing to maintain a reference to the old
Actions