problems with setValueAt()

T

t12be

If we try setting a value in our tableModel the value setted looks
like
[B@...... where the dots stands for numbers. Even if we print the
class of that object, [B is printed.
We used several implementations of tableModel.

Anyone experienced this before?

thx
(e-mail address removed)
 
B

Boudewijn Dijkstra

t12be said:
If we try setting a value in our tableModel the value setted looks
like [B@...... where the dots stands for numbers. Even if we print the
class of that object, [B is printed.
We used several implementations of tableModel.

The object you are trying to pass, is an array of bytes.
TableModel uses Strings to display its values. If an object is passed to
setValueAt(), the toString() method of the object is called to create a
String. You can create a String from the byte array by other methods than
toString(), but you'll have to do that yourself.
 
C

Chris Smith

Boudewijn said:
The object you are trying to pass, is an array of bytes.
TableModel uses Strings to display its values. If an object is passed to
setValueAt(), the toString() method of the object is called to create a
String. You can create a String from the byte array by other methods than
toString(), but you'll have to do that yourself.

For details, see TableCellRenderer

--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
 
T

t12be

Boudewijn Dijkstra said:
t12be said:
If we try setting a value in our tableModel the value setted looks
like [B@...... where the dots stands for numbers. Even if we print the
class of that object, [B is printed.
We used several implementations of tableModel.

The object you are trying to pass, is an array of bytes.
TableModel uses Strings to display its values. If an object is passed to
setValueAt(), the toString() method of the object is called to create a
String. You can create a String from the byte array by other methods than
toString(), but you'll have to do that yourself.

Thx, but didn't get out of it, could je provide me with more information please?
 
B

Boudewijn Dijkstra

t12be said:
"Boudewijn Dijkstra" <[email protected]> wrote in message
t12be said:
If we try setting a value in our tableModel the value setted looks
like [B@...... where the dots stands for numbers. Even if we print the
class of that object, [B is printed.
We used several implementations of tableModel.

The object you are trying to pass, is an array of bytes.
TableModel uses Strings to display its values. If an object is passed to
setValueAt(), the toString() method of the object is called to create a
String. You can create a String from the byte array by other methods than
toString(), but you'll have to do that yourself.

Thx, but didn't get out of it, could je provide me with more information
please?

First you must know what a byte array is, and second you must have read the
tutorial at
<http://java.sun.com/docs/books/tutorial/uiswing/components/table.html>.
Can you ask a specific question?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,679
Members
48,796
Latest member
Greg L.

Latest Threads

Top