You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Filipe Marinho <fi...@SE.EFACEC.PT> on 2005/06/16 17:16:56 UTC

event handlers

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

Another question: do you know if there is an event of the mouse leftclick
(not the general click : both buttons)

thank you for your help

---------------------------------------------------------------
Filipe Marinho
filipe.marinho@se.efacec.pt
> EFACEC Sistemas de Electrónica, S.A
> Rua Engº Frederico Ulrich
> Apart. 3078 - 4471-907 Moreira Maia
> PORTUGAL
Telf 229402000
---------------------------------------------------------------


Re: event handlers

Posted by Jean-Christophe Arnu <ar...@paratronic.fr>.

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