swing Adding StyledDocument to JTextPane

Download swing for free

Example

try {
        JTextPane pane = new JTextPane();
        StyledDocument doc = new DefaultStyledDocument();
        doc.insertString(0, "Some text", null);
        pane.setDocument(doc); //Technically takes any subclass of Document
    } catch (BadLocationException ex) {
        //handle error
    }

The JTextPane can then be added to any Swing GUI form.

Copying DefaultStyledDocument