Note that there are some explanatory texts on larger screens.

plurals
  1. POJEditorPane high cpu usage while showing particular unanimated GIFs
    primarykey
    data
    text
    <p>My application shows RSS entries in a JEditorPane. It works not that bad, but I've encountered a serious issue lately while displaying a gif. Here's a small test case :</p> <pre><code>public class JEditorPaneTest { public static void main(String[] args) { JFrame dialog = new JFrame("JEditorPane test"); dialog.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Container c = dialog.getContentPane(); c.setLayout(new BorderLayout()); JEditorPane editorPane = new JEditorPane(); editorPane.setEditorKit(new HTMLEditorKit()); editorPane.setText("&lt;html&gt;&lt;body&gt;&lt;img src=\"http://feeds.feedburner.com/~ff/MacRumors-All?d=yIl2AUoC8zA\"&gt;&lt;/body&gt;&lt;/html&gt;"); c.add(new JScrollPane(editorPane), BorderLayout.CENTER); dialog.pack(); dialog.setVisible(true); } } </code></pre> <p>The unanimated gif is flickering and the CPU usage is up to 300% (quad-core computer) on Mac OS X or 50% on Windows 7. This issue is even more severe since after disposing the editor pane, the CPU usage is still that high.</p> <p>Looking at some profiling, it looks like 50% of the cpu usage time is in the Event dispatcher thread and the other 50% is in sun.awt.image.ImageFetcher.run().</p> <p>Another interesting fact is that it happens also when embedding html in a JLabel.</p> <p>(EDIT : 9 march 2012) Another interesting fact is that if the file is downloaded locally first (and accessed by file://...) or even, being a resource do not fix anything. But if the image is shown in ImageIcon in a JLabel, there is no flickering and high CPU usage. Somehow, I really need to use a HTML document in a JEditorPane to render some basic HTML formatting.</p> <p>I am looking for a general solution to avoid censoring images from feedburner.com and, these gifs from feedburner.com are the only one I found yet, but I would like prevent having the bug with all other images that could behave the same way.</p> <p>Thanks a lot.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload