views:

4835

answers:

5

Are there are decent implementations of a vector graphics canvas in GWT? I would like to be draw arbitrary shapes and have them react to user input (mouse in/out/click/etc). There are wrappers for the HTML canvas, but that feature is not supported in older browsers (read: IE).

+2  A: 

You might take a look at the GWT-Widgets library. They have a online sample doing just that.

It's probably not a pure vector canvas, but maybe you can use it for your purposes.

Drejc
A: 

Not sure if it helps but if you want to support old IE, you should go with Flash or god forbid Java applets for vector graphics

Yoni Roit
+2  A: 

Both the gwt-incubator's canvas and gwt-canvas support IE by providing some glue code and degrading to VML. Your mileage may vary depending on how many of the features you use (IE won't do gradients for example).

One technique is to create an AbsolutePanel and add the canvas widget to it (which can respond to mouse events). Then you can add other elements on top of the canvas for text and such if you need to.

+5  A: 

I have recently created a project gwt-g2d that branches off from gwt-canvas and provide some newer features for canvas, such as text drawing, shadow, and pixel manipulation. The IE implementation uses excanvas and is working reasonably well. Some features are not supported by all browsers yet, but it is working pretty well on Firefox 3.5 and Safari.

hao1300
+1  A: 

The discussion is old, yet new technologies emerged. You may want to check Vaadin GWT Graphics add-on. It provides support for SVG and VML(for IE)

Atanas Roussev