void () { addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent e) { HoverHyperlinkLabel.super.setText(underlineTextInHtml(myOriginalText)); setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); } @Override public void mouseExited(MouseEvent e) { HoverHyperlinkLabel.super.setText(myOriginalText); setCursor(null); } }); new ClickListener() { @Override public boolean onClick(@NotNull MouseEvent e, int clickCount) { HyperlinkEvent event = new HyperlinkEvent(HoverHyperlinkLabel.this, HyperlinkEvent.EventType.ACTIVATED, null); for (HyperlinkListener listener : myListeners) { listener.hyperlinkUpdate(event); } return true; } }.installOn(this); }