File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes ERROR in all jtable cells using DefaultTableModel Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "ERROR in all jtable cells using DefaultTableModel" Watch "ERROR in all jtable cells using DefaultTableModel" New topic
Author

ERROR in all jtable cells using DefaultTableModel

Aruneesh Salhotra
Ranch Hand

Joined: May 12, 2004
Posts: 167
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

Joined: Feb 07, 2006
Posts: 49
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


SCJP 1.4<br />SCJD (BS2.1.2)
Aruneesh Salhotra
Ranch Hand

Joined: May 12, 2004
Posts: 167
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.
 
 
subject: ERROR in all jtable cells using DefaultTableModel
 
Similar Threads
regarding JTable
JTable
JTable not showing automatically at startup
jtable
probem with populating JTable