Tooltip on JTable cells (take 2)
Monday, March 31st, 2008In a previous post, I explain how to add tooltips to JTable cells. Armand Bendananff told, in a comment, that a better way is to override the table’s getToolTipText method as in:
public String getToolTipText(MouseEvent event) {
Point p = event.getPoint();
// Locate the renderer under the event location
int colIndex = columnAtPoint(p);
int rowIndex = rowAtPoint(p);
String tooltip = "some value based on the row/col";
return tooltip;
}