How to insert image and text into jTable table cell?
3 answers
For image
ImageIcon icon = new ImageIcon("image.gif"); table.setValueAt(icon, row, column); - But so I will add only the image, and I need the text - tayvs
|
Redefine paintIcon with ImageIcon and you can draw everything your heart desires :-), including text ...
- @kff, this is still the answer. Witty, offering a clever solution, but the answer. These deserve, at worst, minuses, but not deletions. - ߊߚߤߘ
|
The void setValueAt method (Object aValue, int row, int column) for a table. You make the panel, add everything you need to it (picture, text, button, ...), you can specify the location on the panel. Then you add this panel as an object in setValueAt to the desired table cell.
|