Subscribe

  • Subscribe  

Java is Still in the RIA Camp

Posted by Charles | February 15, 2008 .

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++;
        }
      }
    }

 javawater Java is Still in the RIA Camp

Leave a Comment

If you would like to make a comment, please fill out the form below.


Name

Email

Website

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word

Comments

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word


Related Posts

1 Comment so far
  1. Rich Tretola  February 15, 2008 1:11 pm

    Charles,

    Please contact me.

    Thanks,
    Rich

<

Direct TV Offers - usdirect has the best directtv deals