StyledDocument包含各种设置样式的方法。比如setCharacterAttributes。
但是我看不到任何删除样式的方法。
有吗?
发布于 2014-03-06 04:08:36
“清除”样式是不可能的。一个人应该通过以下技术获得一个“默认”风格:
Style defaultStyle = StyleContext.
getDefaultStyleContext().
getStyle(StyleContext.DEFAULT_STYLE);然后通过以下方式应用它:
sampleDocument.setCharacterAttributes(0, sampleDocument.getLength(), defaultStyle, true);发布于 2014-03-05 09:58:57
StyledDocument有一个删除命名样式的removeStyle方法。
您的文档必须具有字符属性。可以设置角色属性,然后将角色属性设置为默认值。
https://stackoverflow.com/questions/22186160
复制相似问题