Question: I have a jTable which currently displays and allows editing of a database table, I am now trying to sort adding tuples. 

I am trying to get it to automatically add a row on downarrow at the bottom. So if I am at the bottom on the table and click my down arrow a new row will appear below. I just can't figure out how to do it.

Thanks
James

Answer: 
Action handling of `JTable` happens in `javax.swing.plaf.basic.BasicTableUI`. In your case, you probably need to register a new action for `SCROLL_DOWN_CHANGE_SELECTION`. In the action, check whether the current selection == last row of the table.

If that doesn't work, set a breakpoint in `javax.swing.plaf.basic.BasicTableUI.Actions.actionPerformed(ActionEvent)` to see which action is really executed.
You'll need to create a KeyListener and add this to your table:

```
public void keyReleased(KeyEvent e) {
  int keyCode = e.getKeyCode();
  if (keyCode == KeyEvent.VK_DOWN)
        // check if selected table row = last row and if so: add new row to table model
}

```

greetz,  

Stijn