Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

wait for html page to be loaded

Status
Not open for further replies.

pcplod

Programmer
Aug 29, 2004
4
GB
i m loading html pages in an Jeditorpane

Is there a way to be notified when the page is completely loaded?

i m currently using a sleep which is not the best way to do it

Code:
editorPane.setPage(url) try { Thread.sleep(5000); }
             catch (Exception e) {e.printStackTrace();}
 
Have you tried implementing a HyperlinkListener and registering it using the method :

Code:
addHyperlinkListener(HyperlinkListener listener)

See the documentation on the setPage() method :

[ignore]
[/ignore]

--------------------------------------------------
Free Database Connection Pooling Software
 
dont quite understand what you mean there can you explain more ?

 
Well, I don't know whether it'll work or not, but try having an inner class that implements HyperlinkListener, and then use the method I mentioned earlier to register this class as your listener, which will be notified my the event queue when events occur ...

eg :
Code:
public class MyMainClass {
  
  ...

   editorPane.addHyperlinkListener(new HHListener());
   editorPane.setPage(url);
  
  ...


  class HLListener implements HyperlinkListener {

   void hyperlinkUpdate(HyperlinkEvent e) {
     System.err.println("Got event : " +e +"\n\t event type : " +e.getEventType())
    }
   }
}

--------------------------------------------------
Free Database Connection Pooling Software
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top