I'm trying to set the viewBox attribute on a document and sometimes I
just get a blank screen.

If I change the size and x,y coordinates of the viewbox it doesn't
repaint but if I just change the viewboxs x,y coordinates everytnig
works fine.

If I add a Thread.sleep(100) in the run method before i change the
attributes everything works fine.

I allso have to remove the attribute before I change it or I get a
nullpointer exception every time.
I'm runnig this from the invokeLater method.

If I add the viewBox attribute to the svg file I get a nullpointer
exception when I try to remove it but if there is no viewbox in the
svg file it doesnt complain about it.
I'm using java 1.5_06 and batik 1.6

canvas.getUpdateManager().getUpdateRunnableQueue().invokeAndWait(new
Runnable() {
  public void run() {
      try {
          Thread.sleep(100);
      } catch (InterruptedException e) {
          e.printStackTrace();
      }
      svgRoot.removeAttribute(SVGConstants.SVG_VIEW_BOX_ATTRIBUTE);
      canvas.getSVGDocument().getRootElement().setAttributeNS(
              null,
              SVGConstants.SVG_VIEW_BOX_ATTRIBUTE,
              (character.getPosition_x() - viewWidth / 2) + " "
                      + (character.getPosition_y() - viewHeight / 2) + " "
                      + viewWidth + " " + viewHeight);
  }
});

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to