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 Doss Markus <Ma...@rhein-zeitung.net> on 2002/06/20 13:39:49 UTC
Size of SVGCanvas
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
Re: Size of SVGCanvas
Posted by "M. van Veen" <mi...@microweb.nl>.
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