File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

cannot change JTable values at runtime

 
Bishawjit Dey
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone, I am really stuck with with a JTable problem. I have made a Jtable with AbstractTableModel. The data in the table cells are numbers. I have implemented a table model listener with class declaration. Problem is, I can't change the values of the table during runtime. I tried using fireTableDataChanged(), fireTableCellUpdated() with setValueAt() method inside the tableChanged interface kind of like this

public void tableChanged (TableModelEvent t) {
int a= t.getFirstRow();
int b= t.getColumn();
Object obj = getSource();

setValueAt(obj, a, b);
fireTableDataChanged();
}

but the table cell value doesnt change. I am a kind of newbie in Swing/Awt and Jtable seems to be hardest thing for me to learn. I have googled hours for an easy beginner level tutorial on jtable but couldnt find one. so I am confused as to how I should code to change the cell value. your help will be greately appreciated.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic