• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JTable update

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