WHITE PAPERS  |  PRICING  |  DOWNLOADS

 

username

password

 

 

 

 

 

 

 

 

 

 

  Desktop Edition Details  

 

  > Features  

  > Key Benefits  

  > Screenshots  

  > Standards Supported  

  > Pricing  

  > Download Now

 

 

  Developer Resources  

 

  > API Documentation  

  > Developers Guide  

  > Code Examples  

  > Updated Builds  

  > Technical Articles  

 

 

 

 

 

Jump to:

General WebRenderer Functions

  WebRenderer example code base.

 

Advanced WebRenderer functions

 

Application test examples

 

Deploying WebRenderer

WebRenderer DOM

  

  

 

WebRenderer Status bar

 

 

 

WebRenderer Status Bar functionality

WebRenderer has some convenience methods to allow the construction of a Swing status bar. Using the JProgressBar and JLabels it is easy to create a browser status bar based upon the WebRenderer Browser and Network events.

Using Events to bring your Status Bar to life

WebRenderer has some useful Network Events (com.webrenderer.events) to bring status bars and load progress bars to life.

IBrowserCanvas browser = BrowserFactory.spawnMozilla();

browser.addNetworkListener(new NetworkAdapter() {
   public void onProgressChange(NetworkEvent e) {
       //For getting text of the load progress
       System.out.println("Status Text: "+e.getStatusText());

       //Number of bytes downloaded
       System.out.println("Bytes downloaded: "+e.getCurrentProgress());
  }
});

Within the NetworkEvent class progress bar sizing and increment can be calculated by the following:

public void onProgressChange(NetworkEvent e) {
    //Total number of bytes to download for the page
    int maxNumberOfBytes = e.getMaximumProgress();

   //Status bar progress maximum size
   int maxsize = e.getMaximum();
}

Within the BrowserEvent class events such as onBeforeNavigate and onLinkChange are particularly useful for status bars.

browser.addBrowserListener(new BrowserAdapter() {
   public void onBeforeNavigate(BrowserEvent e) {
      System.out.println("Navigating to: " + e.getURL());
   }
   public void onLinkChange(BrowserEvent e) {
      System.out.println("Link: " + e.getLink()):
   }
});

 

  top

 

 

 Sun, Sun Microsystems, and the Sun Logo are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries 

Privacy Policy  |   Disclaimer