Hope this sample will help...
Using a KeyListener is not the approach to use. Please read the Swing tutorial on "How to Use Key Bindings" to understand how Swing works with KeyEvents. The example won't work. Focus is on the editor not the table.
How to disable Enter key when a cell is in editing mode
Well, as I suggested above, Swing uses Key Bindings to map KeyStrokes to an Action. In the case of an Enter key it is used to provide two pieces of functionality:
a) when editing a cell it is used to stop editing
b) when not editing a cell focus is transferred to the next row.
If you want to remove the functionality of the Enter key completely then you can just remove the Key Binding. Read the section from the Swing tutorial on
How to Use Key Bindings for more information.
If you want to remove the editing functionality, but keep the non-editing functionality then you need to change the default Action. The easiest way to do this it to probably wrap the original Action and to ignore the Enter key when table.isCellEditing() returns true. To help you with this approach you might want to look at the way I customized the deault Tab Action in
Table Tabbing.