Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / March 2004

Tip: Looking for answers? Try searching our database.

Bullet list in StyledDocument (JTextPane)

Thread view: 
Bjrn Brresen - 19 Feb 2004 10:25 GMT
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.



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.