Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Strange Swing Errors

0 views
Skip to first unread message

Goedy Reen

unread,
Nov 20, 2002, 4:25:46 PM11/20/02
to
I keep getting errors like this in my program, and I can't reproduce
them in specific instances. My code isn't mentioned anywhere in this
strack trace, and I'm not sure where to start debugging this. This is
under 1.4.1_01, but it does it under older versions as well. Any
ideas?

javax.swing.text.StateInvariantError: GlyphView: Stale view:
javax.swing.text.BadLocationException: Invalid location
at javax.swing.text.GlyphView.getText(Unknown Source)
at javax.swing.text.GlyphPainter1.paint(Unknown Source)
at javax.swing.text.GlyphView.paintTextUsingColor(Unknown Source)
at javax.swing.text.GlyphView.paint(Unknown Source)
at javax.swing.text.BoxView.paintChild(Unknown Source)
at javax.swing.text.BoxView.paint(Unknown Source)
at javax.swing.text.BoxView.paintChild(Unknown Source)
at javax.swing.text.BoxView.paint(Unknown Source)
at javax.swing.text.ParagraphView.paint(Unknown Source)
at javax.swing.text.html.ParagraphView.paint(Unknown Source)
at javax.swing.text.BoxView.paintChild(Unknown Source)
at javax.swing.text.BoxView.paint(Unknown Source)
at javax.swing.text.html.BlockView.paint(Unknown Source)
at javax.swing.text.BoxView.paintChild(Unknown Source)
at javax.swing.text.html.ListView.paintChild(Unknown Source)
at javax.swing.text.BoxView.paint(Unknown Source)
at javax.swing.text.html.BlockView.paint(Unknown Source)
at javax.swing.text.html.ListView.paint(Unknown Source)
at javax.swing.text.BoxView.paintChild(Unknown Source)
at javax.swing.text.BoxView.paint(Unknown Source)
at javax.swing.text.html.BlockView.paint(Unknown Source)
at javax.swing.text.BoxView.paintChild(Unknown Source)
at javax.swing.text.BoxView.paint(Unknown Source)

Chris Smith

unread,
Nov 20, 2002, 10:23:12 PM11/20/02
to
Goedy Reen wrote ...

> I keep getting errors like this in my program, and I can't reproduce
> them in specific instances. My code isn't mentioned anywhere in this
> strack trace, and I'm not sure where to start debugging this. This is
> under 1.4.1_01, but it does it under older versions as well. Any
> ideas?

You didn't say what you are doing when the errors occur. I distinctly
remember seeing and dealing with this IllegalStateException in our own
code base... and if you'll let me know when it occurs, perhaps I can
scan around for code to fix it.

--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation

Babu Kalakrishnan

unread,
Nov 21, 2002, 7:02:24 AM11/21/02
to
On 20 Nov 2002 13:25:46 -0800, Goedy Reen <javai...@hotmail.com> wrote:
> I keep getting errors like this in my program, and I can't reproduce
> them in specific instances. My code isn't mentioned anywhere in this
> strack trace, and I'm not sure where to start debugging this. This is
> under 1.4.1_01, but it does it under older versions as well. Any
> ideas?
>
> javax.swing.text.StateInvariantError: GlyphView: Stale view:
> javax.swing.text.BadLocationException: Invalid location

First of all check the thread safety aspect of your code. I've seen
similar things occur when you try to mutate a Document (which is the
model for JEditorPane/JTextPane etc) from a thread other than the Event
Dispatch Thread.

BK

Goedy Reen

unread,
Nov 21, 2002, 5:57:42 PM11/21/02
to
Babu Kalakrishnan <ka...@sankya.com> wrote in message
> First of all check the thread safety aspect of your code. I've seen
> similar things occur when you try to mutate a Document (which is the
> model for JEditorPane/JTextPane etc) from a thread other than the Event
> Dispatch Thread.

I was able to narrow it down by disabling a call to setText() on a
JEditorPane, which was being called by a different thread. Of course,
I want this thread to call setText(). Did you find a workaround?

Carl Howells

unread,
Nov 21, 2002, 8:33:34 PM11/21/02
to

That's what SwingUtilities.invokeAndWait and SwingUtilities.invokeLater
are for. Use them.

0 new messages