如何获得与Stackoveflow 中标签JButton的鼠标悬停效果相似的鼠标悬停效果?例如

见JComponent.setToolTipText(String)。工具提示在一定程度上支持 HTML,但不支持在 SO 标记弹出窗口底部提供链接的功能。
为此,您需要将工具提示换成JWindow/JEditorPane您需要自己将其“连接在一起”的位置。这是一个使用JWindow(显示BufferedImage实例)的示例。

您可以使用setRolloverIcon。这是一个例子。
Icon normalIcon = new ImageIcon("normal-icon.png"); // Icon for normal situations
JButton button = new JButton(); // initialize the button
button.setIcon(normalIcon); // set the normal situation icon
Icon rollOverIcon = new ImageIcon("roll-over.png"); // Icon for roll over (hovering effect)
button.setRolloverIcon(rollOverIcon); // Set the icon attaching with the roll-over event