HyperlinkListener (@NotNull HyperlinkListener delegate) { String tooltipText = getHyperlinkTooltip(); if (StringUtil.isEmptyOrSpaces(tooltipText)) return delegate; MyLinkTooltip tooltip = (MyLinkTooltip)new MyLinkTooltip().setTitle(tooltipText) .setShortcut(KeymapUtil.getFirstKeyboardShortcutText(ToolbarLabelAction.this)); tooltip.installOn(this); return new HyperlinkListener() { @Override public void hyperlinkUpdate(HyperlinkEvent e) { if (e.getInputEvent() instanceof MouseEvent mouseEvent) { switch (mouseEvent.getID()) { case MouseEvent.MOUSE_ENTERED -> tooltip.mouseEntered(mouseEvent); case MouseEvent.MOUSE_EXITED -> tooltip.mouseExited(mouseEvent); case MouseEvent.MOUSE_MOVED -> tooltip.mouseMoved(mouseEvent); } } delegate.hyperlinkUpdate(e); } }; }