

When ever mentioning Java it’s all about server side development. Talking about stereotyping! Just you know that if done it right, Java’s still or could be a viable RIA client side technology, of cause aside from JavaFX. Here is an example.
The Java Water Example. Applying simple algorithm, a very realistic water simulation (or effect) can be applied to a image. The code is very simple and short to make this effect happens. The page has detail explanations on how it works. Without knowing this algorithm, a smart Java developer can still make it work but there could be sizeable programming involved. That’s what I meat “done right”. Below is the code and here is the full source (water.java).
public void newframe() {
//Toggle maps each frame
i=oldind;
oldind=newind;
newind=i;
i=0;
mapind=oldind;
for (int y=0;y<height;y++) {
for (int x=0;x<width;x++) {
short data = (short)((ripplemap[mapind-width]+ripplemap[mapind+width]+
ripplemap[mapind-1]+ripplemap[mapind+1])>>1);
data -= ripplemap[newind+i];
data -= data >> 5;
ripplemap[newind+i]=data;
//where data=0 then still, where data>0 then wave
data = (short)(1024-data);
//offsets
a=((x-hwidth)*data/1024)+hwidth;
b=((y-hheight)*data/1024)+hheight;
//bounds check
if (a>=width) a=width-1;
if (a<0) a=0;
if (b>=height) b=height-1;
if (b<0) b=0;
ripple[i]=texture[a+(b*width)];
mapind++;
i++;
}
}
}

If you would like to make a comment, please fill out the form below.
Charles,
Please contact me.
Thanks,
Rich