classCastException when using jTextPane.setLogicalStyle(namedStyle)

From: Dominik (groups_at_mail.businger.ch)
Date: 01/30/04


Date: 29 Jan 2004 16:00:23 -0800

Hi all,

I'm writing an editor in java, using JTextPane, a HTMLEditorKit and a
HTMLDocument. As Style*** i use the javax.swing.text.html.Style***
and to define the styles i use the Style***.NamedStyle class.

whenever i want to apply a namedStyle to a paragraph or set it as
logical style, i get a classCastException, even though NamedStyle
implements the interface Style and JTextPane's method
setLogicalStyle() takes a Style as parameter.

Has anyone had that before? Does anyone know why i get this exception?
...and how to avoid it?

Thanx for any help.

Dominik