After successfully implementing the hyperlink in jEditorPane through this link, I now aim to incorporate a hover effect to the hyperlink.
I attempted to apply CSS using the following code:
MyHTMLEditorKit kit = new MyHTMLEditorKit();
setEditorKitForContentType("text/html", kit);
addHyperlinkListener(createHyperlinkListener());
StyleSheet css= kit.getStyleSheet();
css.addRule("a { color: red;}");
Despite my efforts, the CSS rules like a:hover{color:red;}
did not yield the desired results. I also experimented with attributes like
onmouseover="this.style.color='red'"
, but to no avail.
How can I effectively implement the onhover effect for hyperlinks in jEditorPane?