xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Giselle Machado" <giselle....@gmail.com>
Subject SVG not rendering
Date Tue, 12 Aug 2008 18:40:47 GMT
Hello,

I was using batik in my java application and everything was working fine
while I was in Windows (actually I'm a Linux person, but this is my job, so
I couldn't complain a lot). Then I finally installed ubuntu here and now the
application runs (with no errors) but the SVG is not rendered in the canvas.
The file is correctely generated and when I export it as a JPG, I can see
everything.

The only major difference is the Java version, which was 1.4 in Windows and
now is 6. I'm using Eclipse, but it was set to compile with 1.4 compliance,
so I thought that this shouldn't be a problem. There where a couple of
warnings about deprecated methods but I already removed them. I don't know
what else to do.

The method that sets everything in the canvas is the following:

private void display()
    {
        insertStatusbar();
        insertToolbar();
        setMouseEvents();

        JSVGScrollPane scroll = new JSVGScrollPane(canvas);

        frame.setExtendedState(JFrame.MAXIMIZED_BOTH);
        canvas.setBackground(new Color(0, 128, 128));
        canvas.setDocumentState(JSVGCanvas.ALWAYS_DYNAMIC);

        canvas.addSVGLoadEventDispatcherListener
        (new SVGLoadEventDispatcherAdapter() {
            public void svgLoadEventDispatchCompleted
            (SVGLoadEventDispatcherEvent e) {
                svg.setSVGDocument((SVGOMDocument) canvas.getSVGDocument());
                registerListeners();
                frame.pack();
            }
        });
        frame.addWindowListener(new WindowAdapter() {
            public void windowOpened(WindowEvent e) {
                try
                {
                    java.io.File file = new File(svg.getFilePath());
                    java.net.URL url = file.toURI().toURL();
                    canvas.loadSVGDocument(url.toString());
                }
                catch (MalformedURLException e1)
                {
                    e1.printStackTrace();
                }
            }
        });

        frame.addWindowListener(new WindowAdapter(){
            public void windowClosing(WindowEvent e)
            {
                svg.getFile().delete();
                System.exit(0);
            }
        });
        frame.getContentPane().add(scroll);
        frame.setVisible(true);
    }

Any ideas?

Thanks
Giselle

-- 
"Things do not change; we change."
(Henry David Thoreau)

Mime
View raw message