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 Marc Collin <co...@laboiteaprog.com> on 2006/06/25 18:54:59 UTC

probleme to resize svg image

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: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Re: problem to resize svg image

Posted by th...@kodak.com.
Hi Marc,

Marc Collin <co...@laboiteaprog.com> wrote on 06/25/2006 12:54:59 PM:

> 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

   I think the problem is the SVG file.  The SVG file probably doesn't
provide a viewBox so Batik doesn't know what the real region of interest
is in the file.


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