Article View: borland.public.jbuilder.java.swing
Article #9248Re: Working with StyledDocument
From: Paul Furbacher [TeamB]
Date: Wed, 03 May 2000 00:00
Date: Wed, 03 May 2000 00:00
36 lines
2050 bytes
2050 bytes
"Jean-Fran�ois Leroux" wrote: > > Hi, > I searched the web for hours but found very little information about this > subject. To be more specific, here's what I'm looking for : > > -- I want to create a StyledDocument featuring a kind of TOC - I mean a > title, with nodes and leaves under nodes. I read in Swing tutorial at Sun > site that it was possible with this interface. For example, I'd like to get > a "title" with three "chapters", with "pages" under each chapter, etc. > > -- Here are the questions : > > 1� > -- When I use DefaultStyledDocument.createRootElement (..) and > createBranchElement(..) these elements are initialized at 0,1. How can I put > some text inside ? If I use the insert(..) method, I can only work with > chars or chars[] , which is not correct (for a full paragraph, even less for > a page or a chapter). > -- On the other hand, when I use insertString(..), the text is not set > within this structure... > > 2� > -- Could you give a pointer towards some example or code sample somewhere on > the web ? > That would help a lot ! The best I can do is suggest that you take a look at Keith Topley's second "Core Swing" book which is subtitled "Advanced Programming". I'd say that over half the book is devoted to Document, Style, etc. There may be a few other books on Swing which delve deeply into the subject, but this is the one with which I am familiar. Paul Furbacher (TeamB)
Technical Details
Message-ID:
<391063C3.9BCD5649@home.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<8ekqth$99r8@bornews.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: 111d45,767c5bfe4d48fffc X-Google-Attributes: gid111d45,public From: "Paul Furbacher [TeamB]" <pnf@home.com> Subject: Re: Working with StyledDocument Date: 2000/05/03 Message-ID: <391063C3.9BCD5649@home.com> X-Deja-AN: 618776036 Content-Transfer-Encoding: 8bit References: <8ekqth$99r8@bornews.borland.com> X-Accept-Language: en,pdf Content-Type: text/plain; charset=iso-8859-1 Organization: Another Netscape Collabra Server User Mime-Version: 1.0 Reply-To: pnf@home.com Newsgroups: borland.public.jbuilder.java.swing