Hi Laurent,

Laurent Caron <[EMAIL PROTECTED]> wrote on 11/25/2005 03:48:41 AM:

>         final Frame f = new Frame("Batik");
>         JSVGCanvas svgCanvas = new JSVGCanvas();
> 
>         JSVGCanvas canvas = new JSVGCanvas();
>         canvas.setDocumentState(JSVGCanvas.ALWAYS_STATIC);
>         canvas.setURI(new 
File("C://eclipse//workspace//test//sample.svg").
> toURI().toString());

   I would suggest delaying setting the URI until after the canvas has
been made visible as part of the Frame.  Otherwise when it asks how
large the canvas is it get's zero by zero.  This obviously leads to
some issues in layout. 

>         final JSVGScrollPane scrollPane = new JSVGScrollPane(canvas);
>         f.add(scrollPane);
> 
>         f.addWindowListener(new WindowAdapter() {
>             public void windowClosing(WindowEvent e) {
>                 System.exit(0);
>             }
>         });
> 
>         f.setVisible(true);
>         f.setSize(800, 600);

          canvas.setURI(....);

> When I run, I've got nothing but the Frame. If I resize my window, I can 
see 
> the image, but not the scrollbars. I need to resize my window a second 
time to
> see the scrollbars in action.
> 
> Can you help me make this program work ?

   I think it is as simple as moving the setURI call.

   BTW the default behavior of Batik is to 'fit' content
to the window if there is a viewBox (and there should be a viewBox
if you are using scroll bars).  So by default you shouldn't get
scroll bars until you zoom in or do something else to make the
content 'not fit' the canvas.  You can change this behavior by
overriding calculateViewingTransform (perhaps to return an identity
transform).


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

Reply via email to