使用 jEditorPane 中的超链接,我成功地在 jEditorPane 中添加了超链接。
但现在我想要为超链接添加悬停效果。我尝试使用 CSS 实现,但是…
但现在我想要为超链接添加悬停效果。我尝试使用 CSS 实现,但是…
MyHTMLEditorKit kit = new MyHTMLEditorKit();
setEditorKitForContentType("text/html", kit);
addHyperlinkListener(createHyperlinkListener());
StyleSheet css= kit.getStyleSheet();
css.addRule("a { color: red;}");
其中MyHTMlEditorKit
扩展了HTMLEditorKit
。
我尝试了下面的CSS,但它没有起作用。
a:hover{color:red;}
另外,我尝试在超链接中使用onmouseover="this.style.color='red'"
属性,但它甚至也没有起作用。
那么我如何在jEditorPane中实现超链接的onhover
效果呢?