I am making a text editor roughly like a microsoft word and I am using a textpane with HTML. After doing some research I found a way to apply html to a highlighted section on us
You can implement your own custom Reader/Writer as described here http://java-sl.com/editor_kit_tutorial_reader_writer.html
When you use setCharacterAttributes the content stored in leaves Elements attributes so you can access them and store as you wish.