Table Tabbing shows how you can do it with the keyboard.
I've never tried it but you should be able to use a MouseListener to invoke the same Action when you click on a cell.
Just did a quick test for the MouseListener and it seems to work fine:
JTable table = new JTable(...);
final EditableCellFocusAction action =
new EditableCellFocusAction(table, KeyStroke.getKeyStroke("TAB"));
MouseListener ml = new MouseAdapter()
{
public void mouseReleased(MouseEvent e)
{
JTable table = (JTable)e.getSource();
int row = table.rowAtPoint(e.getPoint());
int column = table.columnAtPoint(e.getPoint());
if (! table.isCellEditable(row, column))
{
ActionEvent event = new ActionEvent(
table,
ActionEvent.ACTION_PERFORMED,
"");
action.actionPerformed(event);
}
}
};
table.addMouseListener(ml);