Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Data doesn't show until I resize frame or click on table  RSS feed

 
Gary Frick
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For some time now I thought that my data wasn't displaying because it wasn't getting process from the array properly. As it turns out, the data is there but won't display until I resize the frame or click on the table. I am firing the 'fireTableChanged(null)' event but this doesn't seem to be the problem. What is causing this?
Here is my method that is part of my AbstractTableModel.
public void loadTableData(Map Cycletally)
{
Collection entries = Cycletally.entrySet();
Iterator it = entries.iterator();
//data = new Vector();
String[] rowData;
int i = 0;
while(it.hasNext())
{
rowData = new String[2];
Map.Entry em = (Map.Entry)it.next();
rowData[0] = em.getKey().toString();
rowData[1] = em.getValue().toString();
data[i] = rowData;
i++;
}
fireTableChanged(null);
}
 
Chantal Ackermann
Ranch Hand
Posts: 508
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
not all events are catched by the table automatically. call "fireTableDataChanged()", that should work.
if not, you might have some threading problem.
chantal
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!