我正在尝试将一个大约 2MB(为了精确起见为 1927KB)的 HTML 文件加载到 JEditorPane 中,这大约需要 65 秒,这似乎是 JTextPane/JEditorPane 的一个错误,我有另请阅读网络上的几篇文章,例如 this one ,但我找不到解决方案...
这是我使用的代码:
final String htmlContent = //Load a 2MB String
previewPane.setContentType("text/html; charset=UTF-8");
previewPane.setText(htmlContent);
如您在我的应用程序日志中所见,setText 方法大约需要 65 秒才能完全执行:
Set the html content(1927KB) of the Preview pane, loading time=68230ms
Set the html content(1927KB) of the Preview pane, loading time=62693ms
Set the html content(1927KB) of the Preview pane, loading time=66583ms
有办法解决这个问题吗?
加载 2MB 的文本大约需要 65 秒,这在 Intel Core 2 Duo 2.93GHz 和 8GB DDR 3 RAM 上是一个糟糕的性能......
最佳答案
关于java - JEditorPane setText 2MB HTML ---> 糟糕的性能!!! (65 秒),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9046365/