Insert Bulleted Or Numbered List Using HTML In JTextPane

JTextPane does not have bulleted list or numbered list support. While making it happen using either StyledEditorKit or RTFEditorKit is not possible unless you create your own, I figure the easiest way to implement this feature would be through the use of an HTMLEditorKit since HTML supports both unordered and ordered lists.

The code below inserts HTML code of an unordered list into the JTextPane. For ordered or numbered lists, you can change the variables of the code and replace the <UL> HTML tag to <OL>.

Related Posts Plugin for WordPress, Blogger...

Leave a Reply

Your email address will not be published. Required fields are marked *