• 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
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

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.
 
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic