File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes JTable update Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JTable update" Watch "JTable update" New topic

JTable update


Joined: Nov 09, 2001
Posts: 4
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,
mohana konakanchi
Ranch Hand

Joined: May 16, 2001
Posts: 67
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)
fireTableCellUpdated(row, col);
Other solutions depends on the way you implementing table model using hashtable. And what do you mean by dynamic table rows?
I agree. Here's the link:
subject: JTable update
It's not a secret anymore!