I'm trying to write a small program which converts between text and html. The user edits the text in a JTextPane, selects bits of it and presses bold, italic etc to format it. This works fine, but I want to convert the formatting to html tags when a button is pressed and I can't find any simple tutorials.
I would like to search through the text a character at a time, and if for example, a character was bold, insert a tag when a plain character is reached, insert a tag.
Can anyone help please!