Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Example code for embedding SVG canvas in SWT project?

Tags:

java

svg

swt

Is there a good example of how to include an SVG canvas into a Java SWT project (particularly Holongate, though I would be interested in any other options)? Additionally, I would need to support this SVG canvas on Mac OS X, Windows and Linux clients, in case an implementation relies on native libraries. Thanks for any pointers.

like image 362
Alex Reynolds Avatar asked Apr 29 '09 22:04

Alex Reynolds


2 Answers

Use batik (http://xmlgraphics.apache.org/batik/). Render SVG into the image. Display it in SWT container. Portable.

like image 85
san Avatar answered Oct 06 '22 01:10

san


We implemented this functionality by embedding a Batik Swing canvas into an SWT composite, see here. It worked fine on Windows, but we couldn't scroll the canvas on Mac OS X.
However, the vast majority of our users were on Windows, so we didn't spend too much time trying to fix the Mac OS X bug.

like image 21
Zsolt Török Avatar answered Oct 06 '22 00:10

Zsolt Török