【发布时间】:2013-10-13 14:31:49
【问题描述】:
我有一个 StyledDocument,我正在向其中添加一些样式。我想要一些适用于我创建的所有样式的默认(全局)样式。例如所有样式的全局背景,这样我就不必为每个样式指定background。
这是我想要达到的目标
public void setUpStyles() {
parentMSGStyle = historyPane.addStyle("parentmsgstyle", null);
userNameStyle = historyPane.addStyle("usernamestyle", parentMSGStyle);
StyleConstants.setBackground(parentMSGStyle, Color.GRAY);
StyleConstants.setForeground(userNameStyle, Color.BLUE);
}
暂时没有。只有蓝色样式有效,但“灰色”样式无效。 我是 StyledDocuments 的新手。请指出正确的方向。
【问题讨论】:
标签: java swing styles styleddocument