RTFEditorKit Has No Bullet List Support

I was trying to make an editor component that included the same functionalities that you would see in editing softwares. Functions like bold, underline, italicize, left align and others. The component I used is a JTextPane and since the code deals with RTF, I used an RTFEditorKit as the EditorKit.

Common functions like bold, underline, italicize, left-right-center align, cut, copy and paste are very simple since Action classes are already part of DefaultEditorKit and RTFEditorKit respectively. However, I was stumped when I tried to incorporate bullet and numbered lists. It seems they are not supported in RTFEditorKit. If the JTextPane would have HTML formatting, it would have been possible but since the format is in RTF, the only possible way for this to happen is to create my own.

Well, I did not. It is not an easy task. I would have to familiarize myself with a bevy of other classes. I did manage to find a working sample of a bullet and numbered list but the code based itself on HTML content. Oh well … the last alternative would be to buy a commercial 3rd party library of an editor.

I also learned that it was not the Java Dev Team responsible for creating the RTF support. And unless they are going to add this feature in the next JDK version (7), I will consider the RTFEditorKit class as incomplete.

Related Posts Plugin for WordPress, Blogger...

Leave a Reply

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