@Override public String getToolTipText(MouseEvent event) { Point p = event.getPoint(); int hitColumnIndex = columnAtPoint(p); int hitRowIndex = rowAtPoint(p); if (hitRowIndex == -1 || hitColumnIndex == -1) return null; TableCellRenderer renderer = getCellRenderer(hitRowIndex, hitColumnIndex); Component component = prepareRenderer(renderer, hitRowIndex, hitColumnIndex); String tip = tooltipMap.get(Pair.of(hitRowIndex, hitColumnIndex)); if (tip == null && component instanceof JComponent) { Rectangle cellRect = getCellRect(hitRowIndex, hitColumnIndex, false); if (cellRect.width >= component.getPreferredSize().width) return null; p.translate(-cellRect.x, -cellRect.y); MouseEvent newEvent = new MouseEvent(component, event.getID(), event.getWhen(), event.getModifiers(), p.x, p.y, event.getClickCount(), event.isPopupTrigger()); tip = ((JComponent) component).getToolTipText(newEvent); } if (tip == null) tip = getToolTipText(); if (tip == null) { Object value = getValueAt(hitRowIndex, hitColumnIndex); if (value != null) { String stringValue = value.toString(); if (!stringValue.isEmpty()) tip = stringValue; } } if (tip != null && !tip.startsWith("<html>")) tip = "<html>" + tip.replaceAll("(\r\n|\n\r|\r|\n)", "<br />") + "</html>"; return tip; }