xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris <unkn...@devnull.org>
Subject How to display SVG on screen using Batik
Date Sun, 12 Oct 2003 21:45:26 GMT
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
<font size="-1">         I have the following working code which reads in 
a PNG graphic and displays it on screen. It uses ImageIO and is fairly simple. 
I have the same symbols in SVG format. I have downloaded Batik from Apache, 
but I can't for the life of me find code to simply load the image and display 
it on screen. Can someone direct me to working code that does this.<br>
import java.io.*;<br>
import java.awt.*;<br>
import java.awt.event.*;<br>
import javax.imageio.*;<br>
public class Example01 extends Frame <br>
    public static void main(String args[]) <br>
        new Example01();<br>
    public Example01() <br>
        super("Java 2D Example01");<br>
        setSize(400,300); <br>
        addWindowListener(new WindowAdapter() <br>
            {public void windowClosing(WindowEvent e) <br>
                {dispose(); System.exit(0);}}<br>
    public void paint(Graphics g) <br>
        Graphics2D g2d = (Graphics2D)g;<br>
            Image bi = ImageIO.read(new File("burda_knitthruback.png"));
            g2d.drawImage(bi, 40, 40, 50, 50, this);<br>
        catch(IOException ioe) <br>

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

View raw message