I have created a jTable and have put an ImageIcon objects in one of the columns. I would like to know how I can get it to display the image rather than the image name as a string.
Thanks
I have created a jTable and have put an ImageIcon objects in one of the columns. I would like to know how I can get it to display the image rather than the image name as a string.
Thanks
You have to implement a TableCellRenderer
and set it for the respective column.
A TableCellRenderer
has just one method which returns a Component
to display in a table cell. However, you probably need to adjust the row heights when you want to display images, since the rows won't adjust automatically to their content.
For how to use custom renderers you can refer to the Java Tutorials.