• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

tableChanged event of TableModelListener

 
James Peter
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am having problem in retrieving data from InteractiveTableModel. Code is like below (part of entire code)



I have one button to print content of table. When I enter the value in table cell and without pressing Enter Key if I click print button I found that content of a cell which is having focus at present is not getting retrieved. I also noticed that tableChanged method is not being called while wevkey in values in cell.

Please let me know how to get rid of this problem.

Thanks
Peter


 
Rob Spoor
Sheriff
Pie
Posts: 20610
63
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
James Peter wrote:When I enter the value in table cell and without pressing Enter Key if I click print button I found that content of a cell which is having focus at present is not getting retrieved.

Call where table is the variable referring to your JTable. That will cause the cell editing to stop (terminate) whenever the JTable loses focus, like when a button is pressed.

I also noticed that tableChanged method is not being called while wevkey in values in cell.

That's because the table cell editor hasn't committed its current value to the JTable yet. It won't until you press Enter, or until you "flush" the data to the TableModel manually (using setValueAt).
 
James Peter
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rob,

It really worked. thanks a lot.


Peter
 
Rob Spoor
Sheriff
Pie
Posts: 20610
63
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic