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)
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
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
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?
That's what SwingUtilities.invokeAndWait and SwingUtilities.invokeLater
are for. Use them.