• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to detect change in JTable cell without leaving the cell and enterin another one

 
Apirak Panatkool
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to detect change in JTable cell without leaving the cell and entering another one. In other words, cell won't get updated if you just leave JTable and go to another component (losing focus). It only get updated if you leave the cell by clicking on another cell.
 
Apirak Panatkool
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In a JTable, if you are editing the (last cell on the) last line, when you hit return nothing happens. It's wanting to move the cursor down a row and it can't, so even though it looks like you've made the change it hasn't actually gone through to the underlying table data.
 
Manfred Leonhardt
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Apirak,
You can programmatically move the editing cell to some other cell and then back again. Visually nothing changes and the table model gets updated with the user none the wiser.
Something like the following should work in most cases:

Regards,
Manfred.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!