xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "M. van Veen" <mich...@microweb.nl>
Subject Re: Size of SVGCanvas
Date Thu, 20 Jun 2002 11:49:02 GMT
Hi!

That's right, you first have to wait untill the whole document has been made 
(otherwise there's no way to determine the document size). This can be done 
by adding a GVTTreeBuilderListener to the canvas. In the
gvtBuildCompleted(GVTTreeBuilderEvent e) function print the size (view the 
API for more details)

Good luck!

Michael.

On Thursday 20 June 2002 13:39, you 
wrote:
> Hi
>
> While trying to read the size of the SVGCanvas with
> getSVGDocumentSize().getWidth() there's a null pointer exception. I trying
> to put the canvas into a window.
> The code:
>         File f = new File("t1.svg");
>         svgCanvas2.setURI(f.toURL().toString());
>         win = new JWindow();
>         final JPanel pop = new JPanel();
>         win.setLocation(800,100);
>         System.out.println(svgCanvas2.getSVGDocumentSize().getWidth());
>         pop.add(svgCanvas);
>         win.getContentPane().add(pop);
>         win.setVisible(true);
>
> The code is taken from the Batik SVGCanvas Tutorial and modified with
> JWindow instead of JFrame. What's wrong while retrieving the svg size ? Are
> there
> Other possibilities to get the size. If I use the example code with JWindow
> I also get a frame around the window. How do I get rid of it.
>
> Thanks
> Markus


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


Mime
View raw message