Hi Patrick.

Patrick Egan:
> Just tried the code in SVN and I still not able to detect the modifier
> keys.
>
>  I have tried both getAltKey() and casting to 
> org.apache.batik.dom.events.DOMMouseEvent to use getModifierState().

Here is some complete code that works for me, using Shift rather than
Alt.  (Alt clicking is captured by my window manager.)  Change the file
in the setURI call and let me know if it works.

  // t.java
  import org.apache.batik.swing.JSVGCanvas;
  import org.apache.batik.swing.gvt.GVTTreeRendererAdapter;
  import org.apache.batik.swing.gvt.GVTTreeRendererEvent;
  import org.apache.batik.dom.events.*;
  import javax.swing.*;
  import org.w3c.dom.*;
  import org.w3c.dom.events.*;
  
  public class t {
      public static void main(String[] args) {
          JFrame f = new JFrame();
          final JSVGCanvas s = new JSVGCanvas();
          s.setDocumentState(JSVGCanvas.ALWAYS_DYNAMIC);
          f.getContentPane().add(s);
          f.setSize(400, 400);
          s.setURI("file:/tmp/t/t.svg");
          f.show();
          s.addGVTTreeRendererListener(new GVTTreeRendererAdapter() {
              public void gvtRenderingCompleted(GVTTreeRendererEvent e) {
                  Document d = s.getSVGDocument();
                  EventTarget c = (EventTarget) d.getElementById("c");
                  c.addEventListener("click", new L(), false);
              }
          });
      }
      protected static class L implements EventListener {
          public void handleEvent(Event evt) {
              DOMMouseEvent mevt = (DOMMouseEvent) evt;
              System.err.println("Shift: " + mevt.getShiftKey());
          }
      }
  }

-- 
 Cameron McCormack                      ICQ: 26955922
 cam (at) mcc.id.au                     MSN: cam (at) mcc.id.au
 http://mcc.id.au/                      JBR: heycam (at) jabber.org

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

Reply via email to