views:

17

answers:

1

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 do I set the font color?

+1  A: 

I would guess you use the StyleConstants.setForeground(...) method.

camickr