Cui Jian: > however, removing the element is the last thing I want to do, because it > might cause concurrent exception if any related thread doesn't work in > time, and most of the time they don't...
As Helder and Thomas said, if you’re manipulating the DOM from the Swing event dispatch thread (in response to the JButton clicks), you’re doing it wrong. > I've tried the elementTimeControl and it works perfectly, remaining one > problem though: > > Actually I want the animation only start if I press the button, which > means it is stopped at first as the svg is loaded. > But if I do the endElement() directly after I initiate the animateColorE > like this: > > animateColorE.setAttributeNS(null, > SVGConstants.SVG_REPEAT_COUNT_ATTRIBUTE, "indefinite"); > ((ElementTimeControl)animateColorE).endElement(); > > I would get a null pointer exception when I start the program: endElement() probably doesn’t work until it’s in the document, which will initialise it. But you can avoid that by having begin="indefinite" on the element. That’ll make it not start when inserted, and just wait for a beginElement() call. -- Cameron McCormack ≝ http://mcc.id.au/ --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
