• 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

ERROR in all jtable cells using DefaultTableModel

 
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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++;
}
}
 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic