I am writing an application and in that I am using JTextArea
to display some text. Now I want to show some clickable URL in text area along with the normal text and I want if user click on the URL then the web page that URL referring to should open in new web browser window.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Use JEditorPane with HTMLEditorKit or JTextPane and set content type to "text/html"
回答2:
..url referring to should open in new web browser window.
// 1.6+
Desktop.getDesktop().browse(URI);