Applets can only connect back to the server from which they reside.  They 
cannot access other sites or your local file system without given explicit 
permission.
 
Michael Bishop

________________________________

From: Mark A Fortner [mailto:[EMAIL PROTECTED]
Sent: Mon 6/26/2006 6:27 PM
To: [email protected]
Subject: Problem with Batik Applet


I wrote a small applet to render an SVG file.  However, it can't seem to render 
the file.  When the applet appears it's blank.

I've debugged through it and there doesn't seem to be any problem.

When I create an application using the same code, the SVG image appears without 
any problem.

I Googled "batik applet" and saw references to an internally developed applet 
in the org.apache.batik.apps package, but it no longer seems to exist.

I've tried both the canvas.setURI approach and the canvas.setDocument approach 
to no avail.

Here's the relevant code that I'm using:

String svgurl = this.getParameter("svg");
        
        canvas.setDoubleBufferedRendering(true);
        canvas.setDocumentState(JSVGCanvas.ALWAYS_DYNAMIC);
        
        canvas.addSVGDocumentLoaderListener(new SVGDocumentLoaderAdapter() {
            public void documentLoadingStarted(SVGDocumentLoaderEvent e) {
                System.out.println("Document Loading...");
            }

            public void documentLoadingCompleted(SVGDocumentLoaderEvent e) {
                System.out.println("Document Loaded.");
            }
        });
        
        canvas.addSVGLoadEventDispatcherListener
        (new SVGLoadEventDispatcherAdapter() {
                public void svgLoadEventDispatchStarted
                    (SVGLoadEventDispatcherEvent e) {
                    // At this time the document is available...
                    document = canvas.getSVGDocument();
                    // ...and the window object too.
                    window = canvas.getUpdateManager().
                        getScriptingEnvironment().createWindow();
                    // Registers the listeners on the document
                    // just before the SVGLoad event is
                    // dispatched.
                    registerListeners();
                    // It is time to pack the frame.
                    //frame.pack();
                }
            });
        
        if (svgurl != null && !svgurl.equals("")) {
            String parser = XMLResourceDescriptor.getXMLParserClassName();
            SAXSVGDocumentFactory f = new SAXSVGDocumentFactory(parser);
            SVGDocument doc;
            try {
                doc = f.createSVGDocument(svgurl);
                canvas.setDocument(doc);
            } catch (IOException e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
            }
            
            
          }
        
        //canvas.setURI(svgurl);
        

If anyone has any ideas, please let me know.

Regards,

Mark Fortner

<<winmail.dat>>

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

Reply via email to