You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by Peter Holland <ph...@gofree.indigo.ie> on 2004/03/19 02:23:09 UTC

Creating a simple Thumbnail.

Hi all, 
I am a computer science student and I have recently started working with
Batik. 
Using the JSVGCanvas example @
http://xml.apache.org/batik/svgcanvas.html I want to add a "Thumbnail"
button which would present a thumbnail of the main SVG file to the user.
I have been working with the ThumbnailDialog class
(org.apache.batik.apps.svgbrowser.ThumbnailDialog) without much joy. 
Can anyone suggest the best way to do this?? 
 
Thanks,
Peter
 

Re: Zooming and Panning Problem.

Posted by Arvinder Singh <an...@WPI.EDU>.
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: batik-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-dev-help@xml.apache.org
>
>
>
>


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


RE: Creating a simple Thumbnail.

Posted by Peter Holland <ph...@gofree.indigo.ie>.
Thanks Thomas, I had a look at the squiggle source code and I seem to
have the problem fixed.
Thanks again,
Peter

-----Original Message-----
From: Thomas DeWeese [mailto:Thomas.DeWeese@Kodak.com] 
Sent: 20 March 2004 00:29
To: batik-dev@xml.apache.org
Cc: xml-batik-cvs@apache.org
Subject: Re: Creating a simple Thumbnail.

Peter Holland wrote:

> I am a computer science student and I have recently started working
with 
> Batik.

Hi Peter,

> Using the JSVGCanvas example @ 
> http://xml.apache.org/batik/svgcanvas.html I want to add a "Thumbnail"

> button which would present a thumbnail of the main SVG file to the
user. 
> I have been working with the ThumbnailDialog class 
> (org.apache.batik.apps.svgbrowser.ThumbnailDialog) without much joy.

    You don't give much to go on to give you help, like what
problem are you having?  Compile? Run????

> Can anyone suggest the best way to do this??

    There is a working example in squiggle the svgbrowser.  All the
source for this is in:  sources/org/apache/batik/apps/svgbrowser

    "Use the Source Luke" (Obi-wan Code-nobe)



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





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


Zooming and Panning Problem.

Posted by Peter Holland <ph...@gofree.indigo.ie>.
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: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org


Re: Creating a simple Thumbnail.

Posted by Thomas DeWeese <Th...@Kodak.com>.
Peter Holland wrote:

> I am a computer science student and I have recently started working with 
> Batik.

Hi Peter,

> Using the JSVGCanvas example @ 
> http://xml.apache.org/batik/svgcanvas.html I want to add a “Thumbnail” 
> button which would present a thumbnail of the main SVG file to the user. 
> I have been working with the ThumbnailDialog class 
> (org.apache.batik.apps.svgbrowser.ThumbnailDialog) without much joy.

    You don't give much to go on to give you help, like what
problem are you having?  Compile? Run????

> Can anyone suggest the best way to do this??

    There is a working example in squiggle the svgbrowser.  All the
source for this is in:  sources/org/apache/batik/apps/svgbrowser

    "Use the Source Luke" (Obi-wan Code-nobe)



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