You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Siarhei Biarozkin <sb...@zandar.com> on 2002/12/11 16:28:40 UTC

Basic question on JSvgCanvas

Hello
Apologies if the question has been answered before, I've found no relevant
info in archives.
My basic question is how to make JSvgCanvas to show an svg content generated
by SvgGraphics2D. I'm working at Windows XP, with JDK 1.4.1
Particularly, I'm using both classes the following way :
I've a subclass of JSvgCanvas, and here its fragment :

class SvgView extends JSvgCanvas {
   SVGGraphics2D gSvg;
   SVGDocument docSvg;

   public SvgView() {

      // initialize SVGGraphics2D, as shown at Batik's Generator page
      DOMImplementation impl = SVGDOMImplementation.getDOMImplementation();
      docSvg = (SVGDocument)impl.createDocument
(SVGDOMImplementation.SVG_NAMESPACE_URI, "svg", null);
      gSvg = new SVGGraphics2D(docSvg);
   }

   public void paintComponent(Graphics g)  {
          // first, let application components draw themselves as usual into
SVGGraphics2D
          activeComponent.draw(gSvg);

          Element root = docSvg.getDocumentElement();
          // the following line doesn't compile
          // getRoot() can't be applied to org.w3.dom.Element
          // looks like getRoot(Element) method doesn't exist ??
          gSvg.getRoot(root);

          setSVGDocument(docSvg);

          // finally, draw itself
          super.paintComponent(g);
    }
}


   }
}

The result is that Svg graphics is not drawn,


Can you please tell me what am I missing in the code ?
Thanks
Seregy Beryozkin


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