0

I want to make a StyledDocument from 2 other StyledDocuments in Java. I tried to do something like this:

textPane.setStyledDocument(textPane.getStyledDocument() + styledDocumentMethod());

but it is not possible to combine them by using a "+".

Is there an other possibility of doing this?

4

1 回答 1

0

显然,不可能以这种方式对两个文档求和。每个文档都有自己的元素结构(节点、叶子)。要正确合并它们,您实际上需要从一个文档实例或另一个文档实例复制所有带有子节点的分支。

该链接显示了它是如何完成的。 http://java-sl.com/tip_merge_documents.html

于 2014-01-30T13:01:41.253 回答