How to insert hyperlinks in RTF document shown in JEditorPane?
smighMay 9 2012 — edited May 10 2012This is a compound question so bear with me on this one :)
What I need is to insert an hyperlink in a JEditorPane; Store it as RTF code; Retrieve it; Show it and click on it to go the the destination.
1) So, first question, is there some method to automatically add the hyperlink and will it be saved in RTF with RTFEditorKit? (I'm actually using AdvancedRTFEditorKit but an answer to either will be enough)
2) I tried a method that adds what appears as a link but the document that is stored doesn't have the necessary RTF codes, only the formatting that makes it look like a link. I also checked the actual RTF codes I'd need to add and they seem easy to do. So, is there a way to add the actual underlying RTF codes to the document while it's in the JEditorPane?
I know the question(s) isn't too specific, if you can shed some light over the whole thing and point me in the right direction, it'd be great!