Loading ...
Sorry, an error occurred while loading the content.

Re: [svg-developers] returning element id from jSvgCanvas?

Expand Messages
  • Thomas DeWeese
    ... I assume that in HTML you would use the onclick event attribute. In Java you need to use EventTarget.addEventListener(...) to register an object to be
    Message 1 of 2 , Jan 29, 2004
    • 0 Attachment
      lemuelSquelch wrote:

      > I am using the jSVGCanvas in my java application. At the moment I am
      > able to add new elements to the svg file giving each an unique id.
      > What I am really struggling on is getting the id to be returned and
      > put in a textfield when I click on the element.

      > I have been looking all over the internet and am struggling to
      > understand it all. I know it can be done in a html page but am
      > struggling to find any good examples for a java application.
      > I am using batik if this helps?

      I assume that in HTML you would use the 'onclick'event attribute.
      In Java you need to use 'EventTarget.addEventListener(...)' to
      register an object to be notified when certain elements recieve

      So something like the following will attach an object to
      an SVG Element.

      Element newElem = ....;
      EventListener clickListener = new ClickListener();
      ("click", clickListener, false).

      class ClickListener implements EventListener {
      public void handleEvent(Event evt) {
      UIEvent uiEvt = (UIEvent)evt;
      Element elt = (Element)uiEvt.getTarget();

      > Any help would be appreciated
      > Thanks
      > -----
      > To unsubscribe send a message to: svg-developers-unsubscribe@yahoogroups.com
      > -or-
      > visit http://groups.yahoo.com/group/svg-developers and click "edit my membership"
      > ----
      > Yahoo! Groups Links
      > To visit your group on the web, go to:
      > http://groups.yahoo.com/group/svg-developers/
      > To unsubscribe from this group, send an email to:
      > svg-developers-unsubscribe@yahoogroups.com
      > Your use of Yahoo! Groups is subject to:
      > http://docs.yahoo.com/info/terms/
    Your message has been successfully submitted and would be delivered to recipients shortly.