The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
August 2001

Advertisement

Advertisement

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.

Message:

Illegal Cast

Posted by John Mac on January 21, 2002 at 6:49 PM


Just like the error message says. You made a illegal cast.

javax.swing.text.StateInvariantError: Illegal cast to MutableAttributeSet


> Hi!

> 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(AbstractDocument.java:1653)
> at javax.swing.text.AbstractDocument$AbstractElement.addAttributes(AbstractDocument.java:1586)
> at javax.swing.text.AbstractDocument$AbstractElement.(AbstractDocument.java:1369)
> at javax.swing.text.AbstractDocument$LeafElement.(AbstractDocument.java:2085)
> at javax.swing.text.AbstractDocument.createLeafElement(AbstractDocument.java:922)
> at javax.swing.text.DefaultStyledDocument$ElementBuffer.fractureDeepestLeaf(DefaultStyledDocument.java:2082)
> at javax.swing.text.DefaultStyledDocument$ElementBuffer.insertUpdate(DefaultStyledDocument.java:1319)
> at javax.swing.text.DefaultStyledDocument$ElementBuffer.insert(DefaultStyledDocument.java:1211)

> 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.

> Regards,
> Laura






Replies:
  • stfu morpheus February 13, 2002 at 1:32 PM (0)

Sponsored Links



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