Hi,
I have written a Swing component which wraps JSVGCanvas, and I would
like to capture DOM mouse click events so that I can draw on the canvas
where the user has clicked. So I register and define my event listener
like this:

public class PlanViewPanel extends JPanel implements MouseWheelListener,
EventListener, SVGLoadEventDispatcherListener {

....... stuff ......

        public PlanViewPanel(SVGDocument svg) {
        svgCanvas.setDocument(svg);
           svgCanvas.addMouseWheelListener(this); // this is for
something else entirely
          scrollPane = new JSVGScrollPane(svgCanvas);
        scrollPane.setScrollbarsAlwaysVisible(true);

scrollPane.setPreferredSize(Toolkit.getDefaultToolkit().getScreenSize());
        add(scrollPane);
        setMinimumSize(new Dimension(800,600));

svgCanvas.getSVGDocument().getRootElement().addEventListener("click",
this, false);
        }
            
             .... stuff ....
        public void handleEvent(org.w3c.dom.events.Event evt) {
                System.out.println("did something");
        
        }

}

but my event handler is never called (I've placed a breakpoint and run
it in the eclipse debugger to confirm this).  I have confirmed also
using a debugger that the event handler is present in the hashtable in
the document root's EventSupport structure, but I do not understand why
it is not called. I have messed around with various different event
types and tried bubble/capture, but nothing works.

Using JDK 1.6.0 and Batik 1.7.

Any suggestions would be greatly appreciated.

Matthew Wilson.



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to