aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes JTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JTable" Watch "JTable" New topic
Author

JTable

francis varkey
Ranch Hand

Joined: Sep 13, 2005
Posts: 169
Respected sirs,

I have a JTable with two columns(I am using DefaultTableModel).The rows are created dynamically. The second column is a JComboBox with some string values.
When I re-editing the first column,I get the prevous value(Using getValue()).
ie. the Table or TableModel not refresh. what is the problem ?

regards Francis
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

Did you press Enter after editing?

Until you press Enter, the value is still just sitting in the editor and is not applied to the model. The same is true if you type into the editor and then mouse out or something...


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
francis varkey
Ranch Hand

Joined: Sep 13, 2005
Posts: 169
no, I dont press enter. It is an application for a client. How to overcome this?

Thanks,
Francis
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

If the cell editor component is a text field, you can add a document listener to it and call stopCellEditing() on any change to the document - this updates the model every time any text changes - you'll get an update to the model for every character entered.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JTable