This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

cannot change JTable values at runtime  RSS feed

Bishawjit Dey
Posts: 4
  • 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);

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.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!