I'm trying to create simple Swing application, which contains few JEditorPanes inside. Each JEditorPane contains text with html tags inside. And also some panes contains html with tags <img src='http://some.url' />
, it means that images might be somewhere in web. And the problem is - if one of the image urls is unavailable - all of my JEditorPanes and whole application hungs. (I'm constructing JEditorPanes in own thread, and after constructing put them into main frame using SwingUtilities.invokeLater(...)
)
I believe that images downloading into JEditorPanes asynchronously, is there any ability to kill these hunging image downloading threads?
Or maybe, there is better solution?
Thanks
P.S. SwingWorker is used. The trouble is - if some image url is unavailable - all of JEditorPanes can't download their pictures. In fact they doesn't hung, but the can't download images. Why?
P.P.S.
Background thread:
JEditorPane jtp=new JEditorPane();
jtp.setContentType("text/html");
jtp.setPreferredSize(newDimension(20,250));
StringBuilder sb=new StringBuilder();
sb.append("<img src='").append(url).append("'/>");
jtp.setText(sb.toString());
SwingUtilities.invokeLater(new Runnable(){
@Override
public void run() {
myPanel.add(rigid,0);
myPanel.add(jtp,0);
myPanel.revalidate();
}
});