The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
August 2001



This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.



Posted by Laura Dietz on August 22, 2001 at 9:41 AM


I got some questions about javax.swing.text.DefaultStyledDocument.

* Is it possible to use DefaultStyledDocument with own implementations (say MyElement) of the Element interface?

MyElement implements Element, AttributeSet and MutableAttributeSet (just like AbstractDocument.AbstractElement) but not AbstractDocument.AbstractElement itself. Most of the public and protected methods of DefaultStyledDocument use interface-types, only the method createDefaultRoot returns an AbstractDocument.AbstractElement. As far as I see, this method is called in the constructor in DefaultStyledDocument.

* Does anyone know what exactly happens in the constructor? Then I could implement my own constructor that does not use the createRootElement method, but a corresponding one that returns of type MyElement?

* Does DefaultStyledDocument really need Elements of type AbstractDocument.AbstractElement for other operations?

Background: Why not use an inheritant of AbstractDocument.AbstractElement?
I'm working on a collaborative authoring tool that uses a groupwareframework (DyCE of GMD Darmstadt). In this framework, every Object that should be replicated must inherit of a special objecttype. Thus I cannot inherit of any other class like AbstractElement.

* Has anyone detailed information about DefaultStyledDocument especially how it works internally?

* If this one will not work: Does anyone have information about ElementBuffer and ElementSpec (I've already read the ElementBuffer atricle on the swing connection)

* Is there anyone who has some experience on DefaultStyledDocument and can advise me to skip this whole DefaultStyledDocument-thing and reimplement the StyledDocument interface?

I need all this stuff for my Diplomarbeit (master thesis) in computer sciences which I study at the Frankfurt university, Germany.

Thank you *very*very* much in advance,
Laura Dietz


Sponsored Links

Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us