• Post Reply Bookmark Topic Watch Topic
  • New Topic

JEditorPane setPage freezing  RSS feed

Brian Flowers
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, so I know this question has been asked a million times, but every solution I find doesn't work.

Basically, I have some code that someone else wrote and I further modified that displays a browser as a tab inside a larger application. Problem is, the browser is a JEditorPane and loads pages via the setPage() method, which causes the entire application to freeze up while the page loads. And if the page can't be found it's even worse, as it's loading the page from a program that won't throw any kind of 'page not found' for sometimes more than 10 minutes - so it basically means you have to forcibly kill the app. But even if the page is found, it takes a non-trivial (at a minimum around 60 seconds) amount of time to load the page, so it's quite unacceptable for the entire app to be locking up.

I've tried making the tab run as a thread, but that dosen't work. I tried creating a new class that extends JEditorPane and implements runnable, but that doesn't work. I tried loading the page's text with the URL's openStream() method and then using setText, and that works except there are no images, and the images are pretty important. I tried setting an HTMLDocument to the page using setBase and then using setDocument, but that doesn't display anything. I tried Thread.currentThread().setPriority() to lower the priority, but that doesn't do anything. And finally, I can't remember the exact code and can't find the original forum post to jog my memory, but I tried using setAsynchronousLoadPriority(10); but still with no luck.

So, anyone have any other suggestions? I can post the code if needed, but I'll need to dig back and find an ealier version of it as it's currently a complete mess from trying to figure this out.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!