Switch to JTextPane instead, that works with StyledDocument instead of Document. Even though the getDocument() method still returns a Document, you can only initialize JTextPane with a StyledDocument so that will be what is actually returned by the getDocument() method.
With the StyledDocument,
you should be able to add any style with the setCharacterAttributes and setParagraphAttributes methods.