I have a JTable that I would like to display a fancy tooltip (basically a JTextArea) for particular cells in a column. I am using a custom cell renderer, so it would be easy if I could figure out how to popup a window when I hover over the cell renderer’s component.
Are there any examples of how to do this?
You can use HTML in tooltips, if you use the
<html>and</html>tags around the content.Use HTML to format the tooltip. Using colored (
<font>) and multi-line (<br>) tooltips is now easy.Creating and overwriting the default
JToolTipis a bit harder. Every component has aJToolTipinstance and you can retrieve this one withJComponent.createToolTip(). To create a custom tooltip, extend the cell renderer and override it’screateToolTipto implement your custom functionality (return a custom extended version ofJToolTip).