Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Swing / AWT / SWT and the fly likes cannot change JTable values at runtime Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "cannot change JTable values at runtime" Watch "cannot change JTable values at runtime" New topic

cannot change JTable values at runtime

Bishawjit Dey

Joined: Aug 21, 2012
Posts: 4
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.
I agree. Here's the link:
subject: cannot change JTable values at runtime
It's not a secret anymore!