Hi,

if I start the little enclosed test program, i get a window (600x600) with a little square (about only .4 of the expected size) at the top middle. After resizing the window by only one pixel, the square resizes istself to the expected size. Any further resizing of the window don't have any effect on the size of the square.

I don't understand this behaviour.

So, whats wrong with my code?

SVG and Java are attached.

Thank you for any help and hints

Reinhard








import java.io.File;
import java.net.MalformedURLException;
import java.awt.*;
import javax.swing.*;
import org.apache.batik.swing.JSVGCanvas;
import org.apache.batik.swing.svg.SVGUserAgentGUIAdapter;
import org.apache.batik.script.Window;
import org.apache.batik.swing.svg.SVGLoadEventDispatcherAdapter;
import org.apache.batik.swing.svg.SVGLoadEventDispatcherEvent;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.events.Event;
import org.w3c.dom.events.EventListener;
import org.w3c.dom.events.EventTarget;
import org.apache.batik.dom.events.DOMMouseEvent;



public class SVGAppTest extends JPanel
{
    Document document;
    JSVGCanvas svg;

    public SVGAppTest(){
        File f = new File("test.svg");                
        JPanel panel = new JPanel();
        svg = new JSVGCanvas();
        svg.setDocumentState(JSVGCanvas.ALWAYS_DYNAMIC);
        svg.addSVGLoadEventDispatcherListener
            (new SVGLoadEventDispatcherAdapter() {
                    public void svgLoadEventDispatchStarted
                        (SVGLoadEventDispatcherEvent e) {
                        // At this time the document is available...
                        document = svg.getSVGDocument();
			// registerListeners();
                    }
                });
        try
        {
            svg.setURI(f.toURL().toString());
        }
        catch (MalformedURLException e)
        {
            e.printStackTrace();
        }
        
        panel.add(svg);
        panel.setPreferredSize(new Dimension(600,600));
        add(panel);
    }

    public static void main(String[] args)
    {
        JFrame frame = new JFrame("SVGTest");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.getContentPane().add(new SVGAppTest());
        frame.pack();
        frame.setVisible(true);
    }


} 

image/svg

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to