For simple zooming and panning you could use this..

----
just add the zoom in action to a button:

    Action zoomIn =
(Action)yourSVGCanvas.getActionMap().get(JSVGCanvas.ZOOM_IN_ACTION);

    JButton zoomInbutton = new JButton(zoomIn);

----
OR
using it in your code.. possibly you could do this..(this should work but
dunno if it is elegant)

zoomInButton.addActionListener(new ActionListener(){
      public void actionPerformed(ActionEvent ae){
                
yourSVGCanvas.getActionMap().get(JSVGCanvas.ZOOM_IN_ACTION).actionPerformed(ae);

        }
 });

similar for panning..

-Arvinder

>
> Can anyone tell me how to use buttons to Zoom and Pan an SVG in an
> SVGCanvas. I've checked the squiggle source code but I'm still not sure
> how to do it. They are similar problems but I don't know how to use the
> JSVGCanvas.ZoomAction(scaleX, scaleY) and
> JSVGCanvas.ScrollLeftAction(int inc) methods in
> org.apache.batik.swing.JSVGCanvas . See code below:
>
>
> zoomInButton.addActionListener(new ActionListener(){
>      public void actionPerformed(ActionEvent ae){
>
>               double scaleX , scaleY;
>               //org.apache.batik.swing.JSVGCanvas.ZoomInAction
>               JSVGCanvas.ZoomAction(double scaleX, double scaleY)
> //?
>               //public static final java.lang.String ZOOM_IN_ACTION
>               svgCanvas.ZOOM_IN_ACTION
> //?
>       }
> });
>
> leftButton.addActionListener(new ActionListener(){
>      public void actionPerformed(ActionEvent ae){
>
>               int inc;
>               //org.apache.batik.swing.JSVGCanvas.ScrollRightAction
>               JSVGCanvas.ScrollRightAction(int inc);
> //?
>               //public static final java.lang.String
> SCROLL_LEFT_ACTION                    svgCanvas.SCROLL_LEFT_ACTION
> //?
>       }
> });
>
>
>
> Any Help would be much appreciated. Thanks,
> Peter
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
>


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

Reply via email to