I did it like that. First I use the keyReleased event, and then I get the row and column number I'm working on, and then set the value in that row. The code is as follows.
private void purchases_TBLKeyReleased(java.awt.event.KeyEvent evt) { int rowWorking = purchases_TBL.getSelectedRow(); int columnWorking = purchases_TBL.getSelectedColumn(); if(columnWorking==3){ model.setValueAt(null, rowWorking, columnWorking); } }
This makes the third column of the table null as soon as I focus on using the keyboard.
Note The same code fragment can be placed in the MouseClicked event.
source share