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

  

  

 

Element from point

 

 

 

Retrieving DOM elements from a mouse click/point on screen

The WebRenderer DOM method elementFromPoint is one of the DOMs most useful and powerful methods. elementFromPoint retrieves the HTML DOM element from the point. This is particularly useful for getting IElements from mouse clicks on screen.

//Required imports
import com.webrenderer.event.MouseAdapter;
import com.webrenderer.event.MouseEvent;

IBrowserCanvas browser = BrowserFactory.spawnMozilla();

//Getting the DOM Document
IDocument document = browser.getDocument();
IElement element = document.elementFromPoint(100, 100);

Practical example in a Mouse Listener

browser.addMouseListener(new MouseAdapter() {
   public void onClick(MouseEvent e) {
         //Getting the IElement from the corresponding click
         IElement element = document.elementFromPoint(e.getX(), e.getY());
         System.out.println("Element:" + element.getTagName());
    }
});

  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