hi

i want to display a svg image, i use batk to use it

if my main class extend a jfram and i use a canvas to display the svg image, 
that work fine

example
[code]
public class JSVG extends JFrame{
    static int windowCount=0;
    public JSVG() {
        super("test");
        JSVGCanvas canvas = new JSVGCanvas(new SVGUserAgentGUIAdapter(this),
                                           true, true) {
                /**
                 * This method is called when the component knows the desired
                 * size of the window (based on width/height of outermost SVG
                 * element). We override it to immediately pack this frame.
                 */
                public void setMySize(Dimension d) {
                    setPreferredSize(d);
                    invalidate();
                    JSVG.this.pack();
                }
            };

        getContentPane().add(canvas, BorderLayout.CENTER);
       ....
      ....
}
[/code]

now i have a main class who extends jframe, i use a borderLayout on the center 
i put a panel, on this panel i put a canvas

/*
public class JonoGui extends JFrame{
        public JLabel lblTimer;
        public JonoGui(){
                super("Jono");
                setSize(640,480);
                lblTimer = new JLabel("test");
                JPanel pane = new JPanel();
                pane.setLayout(new BorderLayout());     
                pane.add("West",lblTimer);
                setContentPane(pane);
                ImgPane imgPane = new ImgPane();
                pane.add("Center", imgPane);    
        }
[/code]

my ImgPane to display the svg image
[code]
public class ImgPane extends JPanel{
        public JSVGCanvas svgCanvas;
        public ImgPane(){
                this.setSize(new Dimension(300,200));
                svgCanvas = new JSVGCanvas(){
                        public void setMySize(Dimension d){
                                setPreferredSize(d);
                                invalidate();
                                ImgPane.this.setSize(d);
                        }                       
                };              
                //Add canvas to the panel
                add(svgCanvas);
...
....
}
[/code]

1. i need to resize the application to see the image
2. i i resize the application, the image is small don't take all the space

you can see the result at 
http://www.laboiteaprog.com/java_problem.png

any idea?


thanks

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

Reply via email to