I need to take text from a source as plain text and display it in a JTextPane or JEditorPane. The source text is not HTML but will contain URLs between square brackets which need to be displayed and function as hyperlinks.
I've considered setting the pane's content type to text/html and surounding the url in html tags but that ends up ignoring the newline characters, which is a bad thing, and i'm not sure how to go about replacing newline characters with "<br/>
". Is there an easy wat to do that?
If doing that means scanning through the whole string wouldn't it be better to just customize how the text is displayed?
So I've also considered the route that involves making my own EditorKit like starturtle mentions in this thread, but he doesn't explain how to do it. I've looked over the code in this article, but it seems like a lot of work, is this the route I should take?
Has anyone ever done this. Any recommendations? Is it better to convert to html or to customize the display?