Article View: borland.public.jbuilder.java.swing
Article #8623Advanced: adding page breaks to Document/JTextPane
From: Jeroen Zwartepoorte
Date: Thu, 03 Aug 2000 00:00
Date: Thu, 03 Aug 2000 00:00
21 lines
1497 bytes
1497 bytes
Hi, I've written a custom JTextPane/DefaultStyledDocument class which needs to have support for page breaks. These page breaks would only be visible at print-time. So nothing should appear visually during runtime. I came up with the following idea: add a custom Element class to the Document named PageBreakElement. This would be an "empty" Element, no AttributeSets, no Content etc. Then during printing i would scan for instances of this Element and then skip to the next page. The problem is that i have absolutely NO idea how to create such an Element and how to insert it into the Document. I've got several books about the swing text package (including the "Core Swing: Advanced Programming") but they almost always skip the Element part (or at least don't go into it in any detail). I know how "normal" insertion is done: insertString(int offset, String test, AttributeSet attr) but how do i insert my own custom Element? Thanks, Jeroen
Technical Details
Message-ID:
<8mbqgb$3hs11@bornews.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,e9ccf1dc422c74f3,start X-Google-Attributes: gid111d45,public From: "Jeroen Zwartepoorte" <Jeroen@xs4all.nl> Subject: Advanced: adding page breaks to Document/JTextPane Date: 2000/08/03 Message-ID: <8mbqgb$3hs11@bornews.borland.com> X-Deja-AN: 654011591 X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Organization: Another Netscape Collabra Server User X-MSMail-Priority: Normal Newsgroups: borland.public.jbuilder.java.swing