• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ERROR in all jtable cells using DefaultTableModel

 
Aruneesh Salhotra
Ranch Hand
Posts: 167
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am extending DefaultTableModel, to implement the JTable, to display the records.

I am setting data through the method. But it sets the cells with the value "ERROR". I am not sure why it is doing so.

public void addData(Vector[] dataValues) {
int length = 0;
if (dataValues != null)
length = dataValues.length;
int index = 0;
while (index < length) {
if (dataValues[index] != null) {
Vector row = new Vector();
for (int i = 1; i <= 7; i++) {
row.add(dataValues[index].get(i));
}

this.addRow(row);
}

index++;
}
}
 
Yupp Cook
Ranch Hand
Posts: 49
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Aruneesh Salhotra:
I am extending DefaultTableModel, to implement the JTable, to display the records.

I am setting data through the method. But it sets the cells with the value "ERROR". I am not sure why it is doing so.

public void addData(Vector[] dataValues) {
int length = 0;
if (dataValues != null)
length = dataValues.length;
int index = 0;
while (index < length) {
if (dataValues[index] != null) {
Vector row = new Vector();
for (int i = 1; i <= 7; i++) {
row.add(dataValues[index].get(i));
}

this.addRow(row);
}

index++;
}
}


Hi

Maybe dataValues[index].get(i)) returns something strange.
I use this.setDataVector(Vector dataVector, Vector columnIdentifiers). It's just one call and runs fine.

Yupp
 
Aruneesh Salhotra
Ranch Hand
Posts: 167
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In your dataValues, r u also storing the rowNumber and the deletedFlag. I need to store them in order when FindByCriteria is called, I need to know the rowNumber in the DB file I am updating.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic