This content has been marked as final. Show 2 replies
Just a follow up to my own question. I found a way to answer my question 2) and I'm now storing the rtf code for hyperlinks. Now, when I show the document in JEditorPane with RTFEditorKit, I get the name of the hyperlink with no formatting indicating that it's a hyperlink.
Example. The link "http://www.google.com" with the name "Google", only shows "Google" in plain text.
Is it because the components I'm using don't support hyperlinks from RTF files even though they're supported from HTML files?
Is there any way you can see this working? Is it possible to include something inside the JEditorPane that the user can click, instead of the hyperlink?
You can add attribute marker as well as formatting to some inserted text. E.g. when you call insertString() pass the formatting and the URL marker attribute in the AttributeSet. Then on click (or double click) listener check character Element (via the method of StyledDocumnet). If the URL marker attribute is here just get the URL value and do your action.
You have to adapt RTFReader/writer though to handle the attribute though.