I would like to implement a bullet list in my JTextPane. I need to use a
DefaultStyledDocument for this, so a HTML won't do.
I'm amazed that this is something that needs to be done from scratch(?).
The way I was thinking of doing it:
- Overriding DefaultStyledDocument's insertString() method to insert a
"\n\u25CF\t" (new line + unicode for bullet + tab) whenever a \n is
recieved.
- Creating a custom TabStop that is used whenever there is a bullet list
- The Paragraph style in a bullet list must get a positive LeftIndent and a
negative FirstLineIndent to give the impression of 'hanging indent' that we
see in tab lists.
This solves some issues, but it's only the beginning.
- What happens when the user selects some text (including bullets) - the
bullets must behave like bullets, not just regular characters
- Deletion of lines
- Correct mouse/arrows navigation through bulleted paragraphs
Has anyone done this? Any hints? Code? :)
Best regards,
Bjørn Børresen

Signature
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
Jim Sculley - 06 Mar 2004 05:15 GMT
Bjørn Børresen wrote:
> I would like to implement a bullet list in my JTextPane. I need to use a
> DefaultStyledDocument for this, so a HTML won't do.
[quoted text clipped - 19 lines]
>
> Has anyone done this? Any hints? Code? :)
A custom View, ViewFactory, etc. will probably be the cleanest way.
Jim S.

Signature
Remove my extraneous mandibular appendages to reply via email.