首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在DefaultStyledDocument上设置字体颜色

在DefaultStyledDocument上设置字体颜色
EN

Stack Overflow用户
提问于 2009-09-02 17:54:14
回答 1查看 614关注 0票数 1

我知道我可以像这样设置javax.swing.text.DefaultStyledDocument的字体大小:

代码语言:javascript
复制
public void apply(DefaultStyledDocument document) {
    final MutableAttributeSet attributeSet = new SimpleAttributeSet();
    StyleConstants.setFontSize(attributeSet, 12);
    document.setCharacterAttributes(0, 80, attributeSet, false);
}

如何设置字体颜色?

EN

回答 1

Stack Overflow用户

发布于 2009-09-02 18:01:08

我猜你用的是StyleConstants.setForeground(...)方法。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/1369199

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档