xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andres Toussaint <and...@onemileup.com>
Subject Re: EventListener on Polygon?
Date Tue, 16 Aug 2005 14:11:58 GMT
What is the SVGGenerator? How are you using it?

I am almost sure that you are not applying the listener to the proper 
element. To confirm, you can query the attributes:

System.out.println(root.getTagName());     <----This should display 
"path"
System.out.println(((Element)root).getAttribute("d"));  <---- This 
should display your path description

Andres.


On Aug 16, 2005, at 3:38 AM, Steiner, Dominik wrote:

> Hi,
>  
> why does my PolygonElement not receive any MouseEvents?
>  
> 1) First I create the Element using the SVGGenerator (this works fine, 
> the element, in my case a GeneralPath, gets displayed)
>     svgGenerator.draw(s);
>  
> 2) Second I get the PolygonElement from the generated <g>-Tree (I 
> wonder if there is a better solution and how I can tell the 
> SVGGenerator not to create the additional <g>-Tags?)
>     Node root = 
> svgGenerator.getRoot().getLastChild().getLastChild().getLastChild();
>  
> 3) Third I add the EventListener which should print out the message 
> when I click on the polygon, but this doesn’t work??
>     ((EventTarget)root).addEventListener("click",new EventListener(){
>  
>       public void handleEvent(Event arg0) {
>         System.out.println("clickeeeeeeeeeeeeeeeeed");
>       }
>      
>     }, false);
>  
>  
> Any ideas?? Thanks in advance for any suggestion.
>  
> Dominik

Mime
View raw message