JEdi​​torPane setText 2MB HTML --->糟糕的表现!!! (65秒)

ale*_*oot 5 java performance swing jeditorpane

我正在尝试将一个大约2MB的大文件(为了精确起见,大小为1927KB)加载到JEditorPane中,它需要大约65秒,它似乎是JTextPane/JEditorPane的一个错误,我也读了几个像这样的网上文章,但我找不到解决方案......

这是我使用的代码:

final String htmlContent = //Load a 2MB String
previewPane.setContentType("text/html; charset=UTF-8");     
previewPane.setText(htmlContent);
Run Code Online (Sandbox Code Playgroud)

您可以在我的应用程序日志中看到,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
Run Code Online (Sandbox Code Playgroud)

有没有办法解决这个问题?

大约65秒加载2MB文本是英特尔酷睿2双核2.93GHz与8GB DDR 3内存的糟糕表现......