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
subject: Alignment for centering text in JTextPane does not work