I need to show multiple icons in a single column in JTable. I am using an modified Icon implementation.
Class IconCollection implements Icon {
Icon[] icons
}
Since it implements Icon interface , I am able to show multiple icons in single column. However I need to assign separate tooltips for each icon. Since JComponent has single setToolTipText() method, it is not possible.
Any suggestions?
Since the
JTablehas a decent implementation ofgetTooltipTextwhich delegates to the component of the renderer, you can completely solve this in the renderer.In the
getTableCellRendererComponentmethod you can return anyJComponent. If you would opt for aJPanelcontaining multiple icon instances with each a correct tooltip (instead of your big icon).