开发者

Disable hyperlinks in JTextPane

I have a JTextPane with HTML contents. Without changing the content type or calling setText, I would like disable the hyperlinks. I want

  • The hyperlinks to have the same style as the surrounding text (usually meaning no underline or blue color)
  • The mouse to not turn into a hand when I move开发者_C百科 it over hyperlinks

What is the easiest way to do this? I already know how to change the hyperlink listener, but now want the links to appear as normal text.


You can define desired style for your "a" tag. E.g. to set forn bigger use

((HTMLDocument)textPane.getDocument()).getStyleSheet().addRule("a {font-size:48px;}");
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜