I create my table from a defaultmodel, then I try this:
And I get inside the cell the memory reference: javax.swing.JLabel[,0,0,0x0,invalid,alignmentX=0.0,alignmentY=0.0,border=,flags=8388608,maximumSize=,minimumSize=,preferredSize=,defaultIcon=javax.swing.ImageIcon@59a34,disabledIcon=,horizontalAlignment=CENTER,horizontalTextPosition=TRAILING,iconTextGap=4,labelFor=,text=,verticalAlignment=CENTER,verticalTextPosition=CENTER]
Does anybody know how to put an image inside a JTable??
I forgot to say that I had already done that, but thanks anyway, that doesn't works either, the same thing happens. I think I have to implement a ColumnRenderer, I'll search the forums for some advice. Anyone can tell me where to find it?
You'll have to roll your own renderer, or find a third party renderer that does this. I believe this specific implementation is actually covered in the tutorial at the Sun website.
Actually, JTable does have default renderers for Icons, but it won't use them unless you return Icon.class or ImageIcon.class in your table model's getColumnClass() method.
I should have mentioned that in my previous posting, sorry. It's the same deal with other column types such as Boolean, Date, and the Number classes.
Since you say you're using DefaultTableModel, you'll have to do something like create an anonymous inner class to override that method.
I've decided not to add thumbnails on my JTable, because creating saceld images requires so much time, and as I don't really need thumbnails I prefer keeping the system fast. Thanks anyway if I have some free time I'll try to add thumbnails to the tables, but first I've got other things to do. Thanks anyway.