xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Teske <daniel.te...@web.de>
Subject problems with the SVGDocumentLoaderListener
Date Thu, 16 Mar 2006 19:34:07 GMT
Hi there..

Since some days i'm trying tofind a way th center the svgDokument into the Canvas.
I'm tryin to discripe my current situation.
I know that the svgDucument must be loadED(!) befor i can work with it.

So i added a listener to the Canvas:

->    jsvgCanvas.addSVGDocumentLoaderListener(new
->                                            SVGDocumentLoaderListener()
->      {
->        public void documentLoadingCompleted(SVGDocumentLoaderEvent e) {
->          //loading complete
->          System.out.println("DOCUMENTsize: " +
->                             jsvgCanvas.getSVGDocumentSize());
->        }
->        public void documentLoadingStarted(SVGDocumentLoaderEvent e) { 
->        }
->        public void documentLoadingCancelled(SVGDocumentLoaderEvent e) { 
->        }
->       public void documentLoadingFailed(SVGDocumentLoaderEvent e) {
->        }
->      });

But when i load the svgDocument 

->     jsvgCanvas.setURI(svgPath.toURL().toString());

the output is "DOCUMENTsize: null" !!

i added the Canvas into my MyJPanel:
->   this.add(jsvgCanvas);

The area where the Canvase have to be is changing some times.
Thats the way i'm realising this:

->   jsvgCanvas.setBounds(newX, newY, newWidth, newHeigth)

It's working good, but is this the right way? i didn't found a better methode.

The next i want to do is to center the svgDocument into to Canvas.
But befor i can do the AffineTransformation i must get the size of the Document.

Thank you very much for help!!
XXL-Speicher, PC-Virenschutz, Spartarife & mehr: Nur im WEB.DE Club!		
Jetzt gratis testen! http://freemail.web.de/home/landingpad/?mc=021130

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

View raw message