xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Patrick Egan <patrick.e...@greshamticket.com>
Subject Re: DOM level 3 MouseEvent
Date Thu, 02 Feb 2006 14:52:58 GMT
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hi Cameron,<br>
<br>
What I overlooked was the numlock key.<br>
<br>
With numlock on <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; the Shift button is detected
if right mouse button is clicked<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; the Shift button is not detected
if left mouse button is clicked<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; the Alt key is not detected in
either case.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; the Ctrl key is not detected
in either case.<br>
<br>
With numlock off all works fine.<br>
<br>
Patrick<br>
<br>
Patrick Egan wrote:
<blockquote cite="mid43DFFE10.7030408@greshamticket.com" type="cite">
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
Hi Cameron,<br>
I have just tried the latest code from SVN and all is working fine now.<br>
I must have overlooked something earlier.<br>
Many thanks,<br>
Patrick<br>
  <br>
Cameron McCormack wrote:
  <blockquote cite="mid20060131223135.GB21777@port.mcc.id.au"
 type="cite">
    <pre wrap="">Hi Patrick.

Patrick Egan:
  </pre>
    <blockquote type="cite">
      <pre wrap="">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().
    </pre>
    </blockquote>
    <pre wrap=""><!---->
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(<a moz-do-not-send="true"
 class="moz-txt-link-rfc2396E" href="file:/tmp/t/t.svg">"file:/tmp/t/t.svg"</a>);
          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());
          }
      }
  }

  </pre>
  </blockquote>
  <br>
  <br>
</blockquote>

<BR>
Important - This e-mail and the information that it contains may be<BR>
confidential, legally privileged and protected by law.  Access by the<BR>
intended recipient only is authorised.  Any liability (in negligence or<BR>
otherwise) arising from any third party acting, or refraining from acting,<BR>
on any information contained in this e-mail is hereby excluded.  If you are<BR>
not the intended recipient, please notify the sender immediately and do not<BR>
disclose the contents to any other person, use it for any purpose, or store<BR>
or copy the information in any medium.  Copyright in this e-mail and<BR>
attachments created by us belongs to the author and<BR>
also asserts the right to be identified as such and object to any misuse.<BR>
</body>
</html>


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