• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

cannot change JTable values at runtime

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic