xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thomas.dewe...@kodak.com
Subject Re: Handling SVG element onclick event
Date Wed, 14 Mar 2007 10:35:19 GMT
Hi Lawrence,

Lawrence Michel <lawrence.michel@swissonline.ch> wrote on 03/11/2007 
07:16:32 PM:

> I'm actually quite new in using Batik. Unfortunately, I was unable to 
> find any useful help over the internet.
> 
> - I have a Swing Java Application containing a JSVGCanvas. The SVG is 
> loaded and printed properly.
> - The SVG has some graphical elements containing onclick attributes.
> 
> How can I (the java application) be notified about each Events triggered 

> by an SVG element?

   You can register a event listener on the root SVG element using
DOM Events (addEventListener).  Note that a listener on the root of
the SVG tree receives _all_ events of the kind your request so you 
may need to filter to just your elements.

   You can also register listeners on just about any single element
but it sounds like registering one listener on the root element is
what you want.

> The idea behind this is that I would like to have this event being 
> handled and dispatched from a custom build java class, which will be 
> responsible to update, for example, another Swing window content (let's 
> say a JTextArea.append("new event from "+TARGET_ELEMENT+" of type 
> "+EVENT_TYPE) ).

   All our DOM events are dispatched in our UpdateManager's thread
so you need to make sure to call over to the swing thread to run 
your swing update code. 


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Mime
View raw message