-
Bug
-
Resolution: Unresolved
-
P3
-
None
-
6
-
Cause Known
-
x86
-
windows_xp
When a Document is installed on a JEditorPane/JTextPane, BasicEditorPaneUI changes the font/color of the Document by changing the Style DEFAULT_STYLE. Changing a Style triggers DefaultStyledDocument.styleChanged to be invoked. styleChanged then notifies DocumentListeners of the change (using invokeLater). This is painful as DocumentListeners must track this first changeUpdated and ignore it, otherwise they might think the doc has been edited and try and save.
Here's the trace:
java.lang.Exception: Stack trace
at java.lang.Thread.dumpStack(Thread.java:1206)
at javax.swing.text.DefaultStyledDocument.styleChanged(DefaultStyledDocument.java:793)
at javax.swing.text.DefaultStyledDocument$StyleChangeHandler.fireStateChanged(DefaultStyledDocument.java:2538)
at javax.swing.text.DefaultStyledDocument$AbstractChangeHandler.stateChanged(DefaultStyledDocument.java:2517)
at javax.swing.text.StyleContext$NamedStyle.fireStateChanged(StyleContext.java:1353)
at javax.swing.text.StyleContext$NamedStyle.addAttribute(StyleContext.java:1489)
at javax.swing.plaf.basic.BasicEditorPaneUI.updateFont(BasicEditorPaneUI.java:392)
at javax.swing.plaf.basic.BasicEditorPaneUI.updateStyle(BasicEditorPaneUI.java:311)
at javax.swing.plaf.basic.BasicEditorPaneUI.updateDisplayProperties(BasicEditorPaneUI.java:225)
at javax.swing.plaf.basic.BasicEditorPaneUI.propertyChange(BasicEditorPaneUI.java:163)
at javax.swing.plaf.basic.BasicTextPaneUI.propertyChange(BasicTextPaneUI.java:79)
at javax.swing.plaf.basic.BasicTextUI$UpdateHandler.propertyChange(BasicTextUI.java:1772)
at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:339)
at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:276)
at java.awt.Component.firePropertyChange(Component.java:7865)
at javax.swing.text.JTextComponent.setDocument(JTextComponent.java:437)
at javax.swing.JTextPane.setStyledDocument(JTextPane.java:133)
Here's the trace:
java.lang.Exception: Stack trace
at java.lang.Thread.dumpStack(Thread.java:1206)
at javax.swing.text.DefaultStyledDocument.styleChanged(DefaultStyledDocument.java:793)
at javax.swing.text.DefaultStyledDocument$StyleChangeHandler.fireStateChanged(DefaultStyledDocument.java:2538)
at javax.swing.text.DefaultStyledDocument$AbstractChangeHandler.stateChanged(DefaultStyledDocument.java:2517)
at javax.swing.text.StyleContext$NamedStyle.fireStateChanged(StyleContext.java:1353)
at javax.swing.text.StyleContext$NamedStyle.addAttribute(StyleContext.java:1489)
at javax.swing.plaf.basic.BasicEditorPaneUI.updateFont(BasicEditorPaneUI.java:392)
at javax.swing.plaf.basic.BasicEditorPaneUI.updateStyle(BasicEditorPaneUI.java:311)
at javax.swing.plaf.basic.BasicEditorPaneUI.updateDisplayProperties(BasicEditorPaneUI.java:225)
at javax.swing.plaf.basic.BasicEditorPaneUI.propertyChange(BasicEditorPaneUI.java:163)
at javax.swing.plaf.basic.BasicTextPaneUI.propertyChange(BasicTextPaneUI.java:79)
at javax.swing.plaf.basic.BasicTextUI$UpdateHandler.propertyChange(BasicTextUI.java:1772)
at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:339)
at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:276)
at java.awt.Component.firePropertyChange(Component.java:7865)
at javax.swing.text.JTextComponent.setDocument(JTextComponent.java:437)
at javax.swing.JTextPane.setStyledDocument(JTextPane.java:133)