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 R Karthick <ca...@yahoo.com> on 2004/06/18 12:22:58 UTC

problem with JSVGCanvas!!!

Hi!!!

I have six to seven JSVGCanvases loaded into a single
applet. It works fine in one system, but when i load i
into another, it doesnt work. Most of the time the
canvas is not show in the appletviewer, and in the
browser, sometimes, the cavas is loaded with the image
and sometimes, when i refresh the page, it is not
loaded.

It is really inconsistent in that way. Is there any
problem with the way I am loading the SVGDocument? 
The piece of code using which i load the SVGCanvas is 

<code>
[snip] 

JPanel svgPanel = new JPanel( new BorderLayout() );

        if (Pref.USE_SVGPANES) {
            JSVGCanvas jsvgcanvas = new JSVGCanvas();
             
            // parse String into DOM Document
            StringReader reader = new StringReader(
SVGImage );
            String parser =
XMLResourceDescriptor.getXMLParserClassName();
            SAXSVGDocumentFactory f = new
SAXSVGDocumentFactory( parser );

            // http://foobar/sample.svg - It is just a
fake uri
            // this is specially important if the doc
reference other doc
            // in relative URI
            try {
                doc = f.createSVGDocument(
"http://foobar/sample.svg",reader );
            } catch( Exception e ) {
                // do nothing
                System.err.println( "ERROR: Error
creating document element" );
            }

           
            // make the document dyanamic for future
loading of data into it.
            jsvgcanvas.setDocumentState(
JSVGCanvas.ALWAYS_DYNAMIC );

            // turn off the zoom in and rotator
effects
            jsvgcanvas.setEnableRotateInteractor(
false );
            jsvgcanvas.setEnableImageZoomInteractor(
false );
            jsvgcanvas.setEnableZoomInteractor( false
);
            jsvgcanvas.setEnablePanInteractor( false
);

            // set the doc to canvas
            jsvgcanvas.setSVGDocument( doc );
            jsvgcanvas.setBackground( Color.blue );
            svgPanel.add( jsvgcanvas );

        } else  {   // not Pref.USE_SVGPANES

            svgPanel.setBackground( Color.white );
            svgPanel.add( new JLabel( SVGImage ) );
            svgPanel.setMaximumSize( new Dimension(
400,100 ) );
            svgPanel.setMinimumSize( new Dimension(
400,40 ) );
            svgPanel.setPreferredSize( new Dimension(
400,50 ) );
        }
[snip]

</code>

Please help!!

Regards,
R K




=====
You are the one, the only one!!!


		
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail 

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


Re: problem with JSVGCanvas!!!

Posted by Tonny Kohar <to...@kiyut.com>.
Hi,

> I have six to seven JSVGCanvases loaded into a single
> applet. It works fine in one system, but when i load i
> into another, it doesnt work. Most of the time the
> canvas is not show in the appletviewer, and in the
> browser, sometimes, the cavas is loaded with the image
> and sometimes, when i refresh the page, it is not
> loaded.

I do not know either, your code seems ok for me. How about try
this:listen for GVTListener and on rendering complete refresh the panel.

Regards
Tonny Kohar
-- 
Sketsa 
SVG Graphics Editor
http://www.kiyut.com



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