File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes savings changes made in JTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "savings changes made in JTable" Watch "savings changes made in JTable" New topic
Author

savings changes made in JTable

Kate Zoy
Ranch Hand

Joined: Feb 11, 2004
Posts: 33
I have a JTable made with a custom made TableModel called MyAbstractTableModel. As far as the action handling goes, this is my code:
table.getModel().addTableModelListener( new TableModelListener(){
public void tableChanged( TableModelEvent tme )
{
int col = tme.getColumn();
int row = tme.getFirstRow();
TableModel model = (TableModel)tme.getSource();
String columnName = model.getColumnName( col );
Object data = model.getValueAt( row, col );
}
this all works fine. Although, when I later go and try to get a value from my table, the change is not internally there. So I figured that after
Object data = model.getValueAt( row, col );
I needed to add another line table.setValueAt( data, row, col );
but that gives me a stackOverFlow. What can I do so that later on in my code , I can do table.getValue( someRow, someCol ); to actually return something. Right now, with the code above, the actual table is never changed (although it looks changed in the GUI) and when i do getValueAt, it returns an empty string.
I'm sorry if this is kind of confusing... it's hard to explain!
Thank you so much!
 
wood burning stoves
 
subject: savings changes made in JTable
 
Similar Threads
JTable, reloading the table...
jtable
Refresh rows of a JTable
Having problem in resetting the value of JTable
Update database by editing the cells in JTable