The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
August 2001


where you can ask and answer Java programming questions."> - a resource for Java and Jini developers
Artima | Search | Java | Design | JVM | Jini | Books | Seminars | Subscribe 

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.


Illegal cast to MutableAttributeSet

Posted by Laura Dietz on August 23, 2001 at 12:07 PM


When I try play with DefaultStyledDocument's element structure I get the following Error:

javax.swing.text.StateInvariantError: Illegal cast to MutableAttributeSet
at javax.swing.text.AbstractDocument$AbstractElement.checkForIllegalCast(
at javax.swing.text.AbstractDocument$AbstractElement.addAttributes(
at javax.swing.text.AbstractDocument$AbstractElement.(
at javax.swing.text.AbstractDocument$LeafElement.(
at javax.swing.text.AbstractDocument.createLeafElement(
at javax.swing.text.DefaultStyledDocument$ElementBuffer.fractureDeepestLeaf(
at javax.swing.text.DefaultStyledDocument$ElementBuffer.insertUpdate(
at javax.swing.text.DefaultStyledDocument$ElementBuffer.insert(

What have I done wrong?
Is it illegal to use MutableAttributeSets?
How can I get Im-MutableAttributeSets? It seems very complicated since most of the instantiable classes implement MutableAttributeSet.


  • Illegal Cast John Mac January 21, 2002 at 6:49 PM (1)
    • stfu morpheus February 13, 2002 at 1:32 PM (0)

Sponsored Links

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