Insertion in JTable

Hi everyone!

I have a big problem with JTable! I want to add an Object into a cell with the following line of code

this.jTable.setValueAt(ob,rowsel,colsel);

the variable ob is an Object which have a String variable with a name, and other variables. I want to get this object when I select a cell with the jTable.getValueAt(..) method. My problem is making the text in the String appear in the cell where I inserted it.

My question is how to insert an Object on a cell and make some text appear on it, because I can only add an Object per cell.

Please I need help! Thanks in advance;)

[622 byte] By [GrEga] at [2007-11-27 5:19:10]
# 1
check this http://www.exampledepot.com/egs/javax.swing.table/InsertRow.html
AnanSmritia at 2007-7-12 10:42:29 > top of Java-index,Desktop,Core GUI APIs...
# 2
The default renderer simply invokes the toString() method of the object to get the text to display. So you can override the toString() method to display whatever you want.
camickra at 2007-7-12 10:42:29 > top of Java-index,Desktop,Core GUI APIs...
# 3
Thanks camickr and AnanSmriti. I implemented the camickr solution and it worked perfectly!It is just what I need!! Congratulations again camickr ;)
GrEga at 2007-7-12 10:42:29 > top of Java-index,Desktop,Core GUI APIs...