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 Customer Support <su...@squarehosting.com> on 2003/04/19 04:40:44 UTC

Cannot access AbstractGraphics2D

Hi,

I installed batik for a customer, but somehow the following code doesn't
compile. The error message is:
TestSVGGen.java:29: cannot access
org.apache.batik.ext.awt.g2d.AbstractGraphics2D file
org/apache/batik/ext/awt/g2d/AbstractGraphics2D.class not found  
SVGGraphics2D svgGenerator = new SVGGraphics2D(document);               
                ^

I checked out the batik-ext.jar file and even all the others, but I
didn't find AbstractGraphics2D anywhere. Where is this class supposed to
be?

Thanks in advance
Jurgen


-------------- Code -----------------------

import java.awt.Rectangle;
import java.awt.Graphics2D;
import java.awt.Color;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.IOException;
import org.apache.batik.svggen.SVGGraphics2D;
import org.apache.batik.dom.GenericDOMImplementation;
import org.w3c.dom.Document;
import org.w3c.dom.DOMImplementation;

public class TestSVGGen {

    public void paint(Graphics2D g2d) {
        g2d.setPaint(Color.red);
        g2d.fill(new Rectangle(10, 10, 100, 100));
    }

    public static void main(String [] args) throws IOException {

        // Get a DOMImplementation
        DOMImplementation domImpl =
            GenericDOMImplementation.getDOMImplementation();

        // Create an instance of org.w3c.dom.Document
        Document document = domImpl.createDocument(null, "svg", null);

        // Create an instance of the SVG Generator
        SVGGraphics2D svgGenerator = new SVGGraphics2D(document);

        // Ask the test to render into the SVG Graphics2D implementation
        TestSVGGen test = new TestSVGGen();
        test.paint(svgGenerator);

        // Finally, stream out SVG to the standard output using UTF-8
        // character to byte encoding
        boolean useCSS = true; // we want to use CSS style attribute
        Writer out = new OutputStreamWriter(System.out, "UTF-8");
        svgGenerator.stream(out, useCSS);
    }
}



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


Re: Cannot access AbstractGraphics2D

Posted by Vincent Hardy <vi...@sun.com>.
AbstractGraphics2D is in batik-awt-util.jar.
Vincent.

Customer Support wrote:
> Hi,
> 
> I installed batik for a customer, but somehow the following code doesn't
> compile. The error message is:
> TestSVGGen.java:29: cannot access
> org.apache.batik.ext.awt.g2d.AbstractGraphics2D file
> org/apache/batik/ext/awt/g2d/AbstractGraphics2D.class not found  
> SVGGraphics2D svgGenerator = new SVGGraphics2D(document);               
>                 ^
> 
> I checked out the batik-ext.jar file and even all the others, but I
> didn't find AbstractGraphics2D anywhere. Where is this class supposed to
> be?
> 
> Thanks in advance
> Jurgen
> 
> 
> -------------- Code -----------------------
> 
> import java.awt.Rectangle;
> import java.awt.Graphics2D;
> import java.awt.Color;
> import java.io.Writer;
> import java.io.OutputStreamWriter;
> import java.io.IOException;
> import org.apache.batik.svggen.SVGGraphics2D;
> import org.apache.batik.dom.GenericDOMImplementation;
> import org.w3c.dom.Document;
> import org.w3c.dom.DOMImplementation;
> 
> public class TestSVGGen {
> 
>     public void paint(Graphics2D g2d) {
>         g2d.setPaint(Color.red);
>         g2d.fill(new Rectangle(10, 10, 100, 100));
>     }
> 
>     public static void main(String [] args) throws IOException {
> 
>         // Get a DOMImplementation
>         DOMImplementation domImpl =
>             GenericDOMImplementation.getDOMImplementation();
> 
>         // Create an instance of org.w3c.dom.Document
>         Document document = domImpl.createDocument(null, "svg", null);
> 
>         // Create an instance of the SVG Generator
>         SVGGraphics2D svgGenerator = new SVGGraphics2D(document);
> 
>         // Ask the test to render into the SVG Graphics2D implementation
>         TestSVGGen test = new TestSVGGen();
>         test.paint(svgGenerator);
> 
>         // Finally, stream out SVG to the standard output using UTF-8
>         // character to byte encoding
>         boolean useCSS = true; // we want to use CSS style attribute
>         Writer out = new OutputStreamWriter(System.out, "UTF-8");
>         svgGenerator.stream(out, useCSS);
>     }
> }
> 
> 
> 
> ---------------------------------------------------------------------
> 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