This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Customer Requirements for Developers and have Marcho Behler on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes tableChanged event of TableModelListener Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Customer Requirements for Developers this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "tableChanged event of TableModelListener" Watch "tableChanged event of TableModelListener" New topic
Author

tableChanged event of TableModelListener

James Peter
Ranch Hand

Joined: Sep 15, 2010
Posts: 115
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

Joined: Oct 27, 2005
Posts: 20050
    
  30

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).


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
James Peter
Ranch Hand

Joined: Sep 15, 2010
Posts: 115
Hi Rob,

It really worked. thanks a lot.


Peter
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 20050
    
  30

You're welcome.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: tableChanged event of TableModelListener
 
It's not a secret anymore!