You add the styles to the document of the JTextPane. There is a page in the java tutorial that has an example (application) of adding styles to a styled document: How to Use Editor Panes and Text Panes.
I tried this way before, but it hasn'nt been working, too.
Joined: Jan 14, 2004
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: Alignment for centering text in JTextPane does not work