defaultstyleddocument

Setting font color on DefaultStyledDocument

I know that I can set the font size on a javax.swing.text.DefaultStyledDocument like this: public void apply(DefaultStyledDocument document) { final MutableAttributeSet attributeSet = new SimpleAttributeSet(); StyleConstants.setFontSize(attributeSet, 12); document.setCharacterAttributes(0, 80, attributeSet, false); } How d...

Insert one DefaultStyledDocument into another DefaultStyledDocument

I want to insert one DefaultStyledDocument into another DefaultStyledDocument. How do I do this? I know of this method: AbstractDocument.insertString(int offs, String str, AttributeSet a) What I really want is something like this: DefaultStyledDocument.insertDocument(int offs, ...

DefaultStyledDocument.styleChanged(Style style) may not run in a timely manner?

I'm experiencing an intermittent problem with a class that extends javax.swing.text.DefaultStyledDocument. This document is being sent to a printer. Most of the time the formatting of the document looks correct, but once in a while it doesn't. It looks like some of the changes in the formatting have not been applied. I took a look at...