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">
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<body bgcolor="#ffffff" text="#000000">
Hi Cameron,<br>
What I overlooked was the numlock key.<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>
With numlock off all works fine.<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>
Cameron McCormack wrote:
  <blockquote cite="mid20060131223135.GB21777@port.mcc.id.au"
    <pre wrap="">Hi Patrick.

Patrick Egan:
    <blockquote type="cite">
      <pre wrap="">Just tried the code in SVN and I still not able to detect the modifier

 I have tried both getAltKey() and casting to 
org.apache.batik.dom.events.DOMMouseEvent to use getModifierState().
    <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();
          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>);
          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());


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>

To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org

View raw message