M
Michael Holtermann
Hi!
I've integrated a SVG graphic with the batik toolkit in a JPanel. Now I'd
like to add an org.w3c.dom.events.EventListener to every Element.
If I call the method like the following:
<code>
EventTarget eventTarget = (EventTarget)(svgDoc.getElementById
("city"));
eventTarget.addEventListener("click", this, true);
</code>
it's possible to click on the graphical element "city" and receive a
org.w3c.dom.events.Event.
I thought it'd be possible to put recursivly each element in a Vector and
then go through the Vector and adds the EventListener:
<code>
private void registerListeners(Vector vector) {
EventTarget eventTarget;
for (int i = 0; i < vector.size(); i++) {
eventTarget = (EventTarget)vector.elementAt(i);
eventTarget.addEventListener("click", this, true);
}
}
</code>,
but nothing happens.
I can't figure out the mistake, maybe there are more simple method...
Thanks, Michael.
I've integrated a SVG graphic with the batik toolkit in a JPanel. Now I'd
like to add an org.w3c.dom.events.EventListener to every Element.
If I call the method like the following:
<code>
EventTarget eventTarget = (EventTarget)(svgDoc.getElementById
("city"));
eventTarget.addEventListener("click", this, true);
</code>
it's possible to click on the graphical element "city" and receive a
org.w3c.dom.events.Event.
I thought it'd be possible to put recursivly each element in a Vector and
then go through the Vector and adds the EventListener:
<code>
private void registerListeners(Vector vector) {
EventTarget eventTarget;
for (int i = 0; i < vector.size(); i++) {
eventTarget = (EventTarget)vector.elementAt(i);
eventTarget.addEventListener("click", this, true);
}
}
</code>,
but nothing happens.
I can't figure out the mistake, maybe there are more simple method...
Thanks, Michael.