Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java Swing vs HTML5 Canvas for interactive animations

I'd like to create an interactive animation like what Visual Thesaurus offers. I'm evaluating the different technologies I could adopt, and I was wondering what are the pros and cons of implementing a graph visualization in a Java applet with Swing or in HTML5 with its canvas (I know only their name)

I know Java and a little Javascript, and I'd like to avoid proprietary technologies

edit: Most important of all: do HTML 5 canvas support event listeners, as it seems to me Swing does?

like image 926
cdarwin Avatar asked Nov 22 '10 17:11

cdarwin


2 Answers

I'd go with RaphaelJS http://raphaeljs.com/ it's a really nice Javascript graphics library. It's not HTML5(canvas) based, it uses vector SVG(& VML) graphics instead, but it will work on most browsers (even older IE). If you want built-in charting see http://g.raphaeljs.com/

Plus, and this is a major plus, you won't be restricted to using applets.

Here's some raphaelJS examples:
http://raphaeljs.com/graffle.html
http://raphaeljs.com/curver.html

like image 155
Kayla Rose Avatar answered Nov 14 '22 15:11

Kayla Rose


With Java you can use prefuse so you will save a lot of time. I don't know if there are similar api's for html5 but if don't, you'll have to write it yourself.

Here is an example using prefuse

The pro is that you dont have to deal with incompatibility issues between browsers. The con is that the jvm may not be installed on the client machine.

You also have to take into account your proficiency in each technology.

like image 34
Enrique Avatar answered Nov 14 '22 14:11

Enrique