String (MouseEvent event) { if (event != null) { Component component = getDeepestRendererComponentAt(event.getX(), event.getY()); if (component instanceof JLabel label) { if (label.getIcon() != null) { String text = label.getToolTipText(); if (text != null) { return text; } } } } return super.getToolTipText(event); }