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 Jane Singer <js...@cc.huji.ac.il> on 2002/08/22 16:04:27 UTC

invalid JSVGCanvas

Hi,

I'm trying to add a JSVGCanvas to a JScrollPane, which is then added to a
JSplitPane. The other pane contains a JTree. Actually, at one point I had
this working, but then I split up the single large file/class into some more
logical files/classes, and it no longer works.


I've checked that the SVG file actually exists, and it views fine in IE.
Also, I put it in a directory whose path contains no spaces.

This reports that the file exists: System.out.println("file exists: " +
svgf.exists());

However, after making the JSVGCanvas, this line reports that it is invalid:

   System.out.println("svgcanvas: " + svgCanvas.isValid() + " (valid)  " +
svgCanvas  );

There is so little code involved here, I can't imagine what is going wrong.

Any advice will be greatly appreciated.

(The code is below.)

Jane


public class SVGDisplay extends JScrollPane{
     Mediator med;
     JSVGCanvas svgCanvas;


public SVGDisplay(String  f, Mediator m) {
    med = m;
    File svgf = new File(f);
    System.out.println("file exists: " + svgf.exists());
    JSVGCanvas svgCanvas = new   JSVGCanvas();
     try{
    System.out.println("svg url: " + svgf.toURL().toString());
    svgCanvas.setURI(svgf.toURL().toString());
        } catch (IOException ex) {
                        ex.printStackTrace();
                   }
     System.out.println("svgcanvas: " + svgCanvas.isValid() + " (valid)  " +
svgCanvas  );
     this.add(svgCanvas) ;
     this.setPreferredSize(new Dimension( m.getRWidth(), m.getHeight()));

    }

//......


}



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


Re: invalid JSVGCanvas

Posted by Jane Singer <js...@cc.huji.ac.il>.
I ran the Batik SVGApplication and realized that this too reports the
SVGCanvas as being "invalid" (valid = false), but the SVG file displays
fine.
So my problem is probably not due to this at all.
What exactly is the meaning of this attribute?

Jane


----- Original Message -----
From: "Jane Singer" <js...@cc.huji.ac.il>
To: "Batik Users" <ba...@xml.apache.org>
Sent: Thursday, August 22, 2002 4:04 PM
Subject: invalid JSVGCanvas


> Hi,
>
> I'm trying to add a JSVGCanvas to a JScrollPane, which is then added to a
> JSplitPane. The other pane contains a JTree. Actually, at one point I had
> this working, but then I split up the single large file/class into some
more
> logical files/classes, and it no longer works.
>
>
> I've checked that the SVG file actually exists, and it views fine in IE.
> Also, I put it in a directory whose path contains no spaces.
>
> This reports that the file exists: System.out.println("file exists: " +
> svgf.exists());
>
> However, after making the JSVGCanvas, this line reports that it is
invalid:
>
>    System.out.println("svgcanvas: " + svgCanvas.isValid() + " (valid)  " +
> svgCanvas  );
>
> There is so little code involved here, I can't imagine what is going
wrong.
>
> Any advice will be greatly appreciated.
>
> (The code is below.)
>
> Jane
>
>
> public class SVGDisplay extends JScrollPane{
>      Mediator med;
>      JSVGCanvas svgCanvas;
>
>
> public SVGDisplay(String  f, Mediator m) {
>     med = m;
>     File svgf = new File(f);
>     System.out.println("file exists: " + svgf.exists());
>     JSVGCanvas svgCanvas = new   JSVGCanvas();
>      try{
>     System.out.println("svg url: " + svgf.toURL().toString());
>     svgCanvas.setURI(svgf.toURL().toString());
>         } catch (IOException ex) {
>                         ex.printStackTrace();
>                    }
>      System.out.println("svgcanvas: " + svgCanvas.isValid() + " (valid)  "
+
> svgCanvas  );
>      this.add(svgCanvas) ;
>      this.setPreferredSize(new Dimension( m.getRWidth(), m.getHeight()));
>
>     }
>
> //......
>
>
> }
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org
>
>



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