Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JTable update

 
PriyaRajan
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear friends,
I have problem in updating JTable. My program get i/p data for the table from other classes and tries to update the table. isCellEditable() is false, because I dont want user to type anything in my table. when the table data changes, it fires fireTabledatachanged() event.
I am extending AbstractDataModel() class and my table data is stored in a hashtable. The data changes very fast. so to avoid flickering, I moved from applets to JApplet and I am using JTable. Is there anyother choice available for me?
where to put the code for update in my (DataModel)class? setvalueat(row,col) is not possible for me, since I use hashtable. I cannot use arrays, since the datatypes are varying and the length of the table also grows dynamically.
Thank u,
Priya
 
mohana konakanchi
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if your using hashtable, better make row and col number as key
so that you can use setValueAt()
public void setValueAt(Object value, int row, int col)
{
myHashTable.put(row+"-"+col,value);
fireTableCellUpdated(row, col);
}
Other solutions depends on the way you implementing table model using hashtable. And what do you mean by dynamic table rows?
Mohana
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic