xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jean-Christophe Arnu <a...@paratronic.fr>
Subject Re: event handlers
Date Thu, 16 Jun 2005 15:32:50 GMT


Filipe Marinho m'expliquait  (le 16.06.2005 17:16):

> Hi
>
> I wanted to put a event listener for the click on the mouse on some 
> svg elements. (all treated in one listener (method)).
>
> the thing is that i dont know who was cliked. Can you halp me??
>
SVGOMElement source = (SVGOMElement)evt.getTarget();
may give you the event source

> Another question: do you know if there is an event of the mouse 
> leftclick (not the general click : both buttons)
>
You've got to read some doc about


    org.apache.batik.swing.gvtInteractor interface which inherits from
    the MouseListener Interface so that the mouseClicked(MouseEvent me)
    method and particulary MouseEvent will give you what you want

Another method is the startInteraction(InputEvent) of the Interactor 
interface :
public boolean startInteraction(InputEvent ie) {
                return    ie.getID() == MouseEvent.MOUSE_PRESSED && 
(mods & InputEvent.BUTTON1_MASK) != 0
             }

Only reacts on LMB pressed :)

Goodluck


-- 
Jean-Christophe Arnu
Paratronic


---------------------------------------------------------------------
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